Skip to content

Improve PIC image processing on iOS#3781

Open
ewpatton wants to merge 1 commit intomit-cml:masterfrom
ewpatton:hotfix/ios-pic-images
Open

Improve PIC image processing on iOS#3781
ewpatton wants to merge 1 commit intomit-cml:masterfrom
ewpatton:hotfix/ios-pic-images

Conversation

@ewpatton
Copy link
Member

Change-Id: I5eceabcf4323b26fbdf0ce360d8f88ade689e067

General items:

For all other changes:

  • I branched from master
  • My pull request has master as the base

What does this PR accomplish?

This PR fixes a bug in the ClassifyImageData block of PIC. Base64 encoding the image results in lines ending with "\r\n" (Windows) rather than the assumed "\n" (macOS/iOS/Unix), so I adjusted the logic to take that into account. I also made it so that images are centered vertically in the viewport rather than truncated at the bottom. I think this is more closely what people might expect given the target of any given photo is likely to be close to the center of the camera.

Change-Id: I5eceabcf4323b26fbdf0ce360d8f88ade689e067

UIGraphicsBeginImageContext(CGSize(width: width, height: height))
image.draw(in: CGRect(x: 0, y: 0, width: width, height: height))
UIGraphicsBeginImageContext(CGSize(width: width, height: width))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height: width ??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In reality the variable should probably be renamed to size since the inputs are square.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants