What is the most memory-efficient way of downscaling images on iOS?

前端 未结 6 2076
后悔当初
后悔当初 2021-01-31 19:18

In background thread, my application needs to read images from disk, downscale them to the size of screen (1024x768 or 2048x1536) and save them back to disk. Original images are

6条回答
  •  闹比i
    闹比i (楼主)
    2021-01-31 19:45

    I would try using a c-based library like leptonica. I'm not sure whether ios optimizes Core Graphics with the relatively new Accelerate Framework, but CoreGraphics probably has more overhead involved just to re-size an image. Finally... If you want to roll your own implementation try using vImageScale_??format?? backed with some memory mapped files, I can't see anything being faster.

    http://developer.apple.com/library/ios/#documentation/Performance/Conceptual/vImage/Introduction/Introduction.html

    PS. Also make sure to check the compiler optimization flags.

提交回复
热议问题