I am working on an image-browser app for OS X. It is very similar to QuickLook: you pick a folder, the app displays the first image in it, and you can use the arrow keys to quickly move to the next/previous picture.
Now, I'm testing my app with RAW format pictures that are very large: for instance, I have a .cr2 file that is almost 25 MB. NSImageView takes 5 to 10 seconds to load this kind of pictures. I would like the transition from a picture to the next to be as fast as possible. I see 2 options:
1) load the picture incrementally and display it as it is being loaded (either by chunks or by gradually improving resolution). Is it possible to do this? How?
2) scale down pictures so that NSImageView can display them instantly (I don't care too much about resolution). How fast can you scale a picture?
Thanks!
You can preload previous and next images while a given image is displayed. You just have to construct a table of 3
NSImage
, shift them as needed and load a new one. So that your images were almost all the time already loaded before displaying them. Of course, this will not work if you press keys very fast. You can also preload any number of image if needed. Remember thatNSImage
has a caching mechanism inside.