Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to specify the image resolution and various other fixes an enhancements #37

Merged
merged 14 commits into from
Sep 14, 2013

Conversation

matej
Copy link
Contributor

@matej matej commented Jun 17, 2013

Here are a few fixes and enhancements, that I've accumulated while integrating this great component into a new app. Some of them might be useful for a broader audience, so feel free to merge this in or just cherry pick stuff that seems useful.

The main improvement is the ability to efficiently capture hi-resolution images (with the appropriate asynchronous GPUImage calls and fallbacks) and to specify the exact desired size of the final images (or to get the maximum possible size if not specified).

matej added 12 commits June 7, 2013 17:06
… image size.

- added requestedImageSize property, defaults to CGSizeZero, which means largest possible size
- when possible using capturePhotoAsImageProcessedUpToFilter:withCompletionHandler: to get the largest possible image size for the current device
- setting up a custom capture filter chain that crops (and resizes) the hi-res image, while still using as little memory as possible
- this seems to be the current convention
- improves cocoapods support
- checks for a renamed class in older GPUImage versions
- implemented a better method to show the image library if there is no camera available (showing only once per picker invocation and without any delays)
- the UI can now stay visible if there is no camera available (camera-related buttons are hidden, no need to dismiss the picker if we don't select an image in the image library)
@dmitric
Copy link
Owner

dmitric commented Jun 21, 2013

Hey @matej thanks for submitting this. I used to have full resolution capture but folks complained of crashes so in the repo version I set it down a notch. I will run this over and get back to you, but for the most part it looks like refactoring, yes? Also, how does it perform with another filter added in the chain to force the sizing?

@matej
Copy link
Contributor Author

matej commented Jun 25, 2013

I observed a lot of crashes during development, mainly due to very high memory usage. I than spent quite some time in Instruments, tacking down memory problems and figuring out the best GPUIMage configuration and settings. This lead to the code I submitted, which works pretty well for me.

Yes, there is some refactoring in this pull request as well. I have added prefixes to some reusable classes to avid namespace collisions and did a few tweaks now and then but nothing drastic. I also tried to maintain the code style.

I'm not entirely sure I understand what you're asking in your last question. I didn't notice any significant performance problems. During the preview stage the images returned from the camera are fairly small, so it performs just as before. After the capture the filters are applied to more-or-less static content, so filters still be applied quickly enough. It wouldn't probably be a problem to add something like this to the static filter chain to scale the image down to the actual pixel size of the preview view and to get even better performance.

matej added 2 commits July 2, 2013 12:04
 - filters and ui (xib)
 - those resources can bow be skipped if the host application provides it's own resources
dmitric added a commit that referenced this pull request Sep 14, 2013
Added the ability to specify the image resolution and various other fixes an enhancements
@dmitric dmitric merged commit e69ad62 into dmitric:master Sep 14, 2013
@dmitric
Copy link
Owner

dmitric commented Sep 14, 2013

Sorry this took so long. Great work cleaning stuff up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants