Right now I'm writing a C++ tool that tries various methods of compression/quality/etc in order to get a small filesize without losing too much quality of the image. Basically I was planning of having a loop that cycles the quality if an Image down one point at a time until the difference between it and the original Image reaches a threshold. ( Just to add, I'm initially loading up a PNG32, but this current compression loop converts it to JPEG ) Here is the problem I'm having. Right now I have a loop that looks something like this...
Code: Select all
while( /*Check to see if difference threshold is met && imageJPG.quality() > 1*/ )
{
imageJPG.quality( imageJPG.quality() - 1 );
imageBase.compare( imageJPG );
}
In the end, I'd like to download the quality of the JPG until the number of pixels that change reaches a certain threshold. This is purely a brute-force approach, nothing fancy. Thanks ahead of time for your help.