开发者

resizing images will giving memory warning

I am developing image framing application for iphone. when i choose image from image-picker controller and after zooming , cropping,pairing with frame i will save the image. for that i am drawing image context over image. a开发者_运维问答ctually my image is of 1200*1600 size but our connivance taking image frame of 320*480. so after drawing image, size of image is not as iphone photo size. So for that i am resizing the image with 1200*1600 size. here i am getting memory warnings and when i check with instruments for drawing image with 1200*1600 size its taking up to 130mb. my app is crashing after this. i trying with all different ways. but i am unable to overcome this issue. So please help me to overcome this.

Thanks in advance


The documentation saids that the maximum image size should be smaller than 1024x1024. So I think that your issue comes from your tall image size.

You should avoid creating UIImage objects that are greater than 1024 x 1024 in size. Besides the large amount of memory such an image would consume, you may run into problems when using the image as a texture in OpenGL ES or when drawing the image to a view or layer. This size restriction does not apply if you are performing code-based manipulations, such as resizing an image larger than 1024 x 1024 pixels by drawing it to a bitmap-backed graphics context. In fact, you may need to resize an image in this manner (or break it into several smaller images) in order to draw it to one of your views.

(see the UIImage Class Reference)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜