Since some Image instance may do very heavy operations in it, ImageLock::read sometimes takes very long time. To make it faster, you can use ImageCache function to insert cache. The folloing sample illustrates how to use ImageCache:
#include "pxl_imageutils.h" using namespace Celartem::ImageUtils; ... AutoPtr<Image> cached = ImageCache(verySlowImage);
Anyway, it also may be slow even if you adopt ImageCache. If you are trying to display the image on the display quickly, you had better introduce Delayed Drawing.
They loads metadata and some of the image information and they don't load any actual image data. Since some applications may want to load only metadata but image data, we provide a way to do so. But Doc::createImage also does not load any image data. It only create an Image instance that manages the physical memory space for the image. The loading of the actual image data is done on demand; it is done on the time you calls ImageLock::read if no cached image is available.
You can use ToSRGB for this purpose.
Use MetadataUtils::getXResolution and MetadataUtils::getYResolution function.
The cause is quite simple. PixelLiveSystem::load / DocFactory::load accesses to the Storage instance and they does not rewind the storage pointer. All you have to do is put Storage::setPos just before the second load.