Open iamcam opened 12 years ago
When you say that you used -forceProcessingAtSize: right before you took the photo, where did you place that call? Did you happen to have a crop filter that you were using this with? I know that there's currently something odd with crop filters and forced processing sizes, but that zooming in on the image sounds like a bug somewhere.
Yes - it's literally the capturePhoto...
call. My filter chain looks like [camera] -> [resize] -> [crop] -> [Fx]...
So, in situation # 2 I described above,
[self.resizeFilter forceProcessingAtSize:CGSizeMake(1200.0, 1600.0)];
[self.stillCamera capturePhotoAsImageProcessedUpToFilter: self.squareCropFilter
withCompletionHandler:^(UIImage *processedImage, NSError *error) {
This does remind me of the zoom bug when trying to use the -forceProcessingAtSize:
on crop filters, so I was surprised to see this pop up when using on the preceding filter.
@BradLarson Do you have any ideas what the problem is? In theory the changes should be immediate and affect all downstream filters, but it really only works if the forced size is applied well before capture.
For now, though I don't think it's the best way, I will probably resize the image immediately after capture and discard the full-sized image to free up memory. This should be fine, right (I'm not even sure if the @autoreleasepool is necessary)?
GPUImageBrightnessFilter *tmpResize = [[GPUImageBrightnessFilter alloc] init];
[tmpResize forceProcessingAtSize:CGSizeMake(1200,1200)];
@autoreleasepool {
self.selectedImage = [[GPUImagePicture alloc] initWithImage:[tmpResize imageByFilteringImage:processedImage] smoothlyScaleOutput:YES];
processedImage = nil;
tmpResize = nil;
}
I think the next question if/when this is solved, is how to even know the device camera(s) resolution before capture so we don't overshoot it, but I'll leave that for another ticket.
I'm running into enough memory problems on the 4S because it takes very large photos. I'm attempting to use forceProcessingAtSize: to take a smaller photograph (not offered by the AV presets), but that has two downsides: (assume the new size is 1000px wide)
Is there any way to resample the image with this framework so that I see the same things as the 2448px wide image, but in a new 1000px wide size?
If not, I assume I'll have to do something like this to the full-size image in the background and update my filters once the smaller image is available. http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/
Any input is appreciated.
Thanks!