I'm developing a simple image processing app and I've encountered an issue on my test unit (iPhone 3G) that generally any image over 1024x1024 pixels will cause the app to crash when saving.
The process my app follows:
User selects an image via UIImagePicker
A working copy of the selected image is created and resized to the view bounds (eg 320x480) for performance.
User does their image manipulations on the working copy and presses save
The same manipulations are done on the original full-res image, then saved to the photo album.
If the image is is the region of 1024x1024 all is fine, if too large the app crashes without any memory warning.
After searching through stackoverflow it seems that there this a recommendation from Apple to not exceed 1024x1024, however I've found that the PhotoShop Express app on the same iPhone 3G is able to save images at their original high resolution (eg 1534x2034).
Could someone give me some ideas as to how to save high-res images to the photo album like PhotoShop Express is able to?
Thanks.
Even though there is no memory warning, I'm assuming this is a memory issue. We'd need more information about your crash to know for sure. How are you saving it? Are you using ALAssetsLibrary or UIImageWriteToSavedPhotosAlbum? Note that the latter has methods that work with CGImageRef or NSData. Its worth trying all applicable methods to compare.
Thought I'd share how I moved forward with this issue...
Not ideal, but at least this prevents the crash, and allows individuals with newer hardware (eg 3Gs or 4) to save at higher resolutions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.