Hey, guys. Ain't there any idea?![]()
Hey, guys. Ain't there any idea?![]()
Qt doesn't really give you access to the primitive graphics and image file functions you need to do this properly. If your solution works for your purposes, then you're done. But as noted, there are potential problems with it.
Most modern image formats use some sort of compression. In JPEG, images are processed in 8x8 blocks, so you would need access to the raw JPEG library to read strips, which would decompress into more than a single line. Other formats, like JPEG2000, use wavelet transforms for compression, and the spatial information in the image is scattered throughout the compressed data, making retrieval of individual lines or blocks problematic.
For similar reasons, your procedure of removing blocks, reducing them and then stitching them back together to produce a single, reduced image may produce "seams" around the edges of your individual tiles, because the compression algorithm relies on a broad "neighborhood" around each pixel and behaves differently near edges. You'll want to inspect your images carefully after reassembly to see if these are visible, or if they are objectionable.
A better solution would be to use a tool like ImageMagick, an image processing toolkit that can be used from either the command line or through a C++ interface. It allows you to set the maximum amount of memory an operation will consume, and is careful not to exceed that limit, although more memory results in greater execution speed. But when dealing with really huge images, it is often the best solution available. It's scaling algorithms are top-notch, as well, and their advantages and shortcomings are carefully documented. Plus, it's free.
Astrologer (29th April 2010)
Yes, it seems to be a great library, though I just skimmed over it. I am going to plough on with the library. Thank you all, guys.
Bookmarks