I want to load a thumbnail representation of an image that is located in the Documents directory.
If I were just using the Camera Roll I could use the Assets Library Framework to do this. With movies I can use AV Foundation.
However, in my use case all I can figure out is to load the entire image into memory (2 megs and beyond),开发者_开发技巧 then grab a smaller representation of that image and release the larger.
I'm thinking there must be a better way.
Unless there's already a thumbnail image somewhere, then no, there's no more efficient way to do it. A JPEG or PNG image does not, by default or definition, contain a smaller version of itself.
Consider checking for a "[filename].thumbnail" file in the same directory as "[filename]". If you find it, use that; if not, load "[filename]", create the thumbnail, and write it to "[filename].thumbnail" so that the next time you use the image, a thumbnail version exists.
精彩评论