Function that return the file size of a formated resized AND copressed QImage before save()?
-
Hi,
I'm looking for a way to determine the file size of a QImage that got loaded formated and resized without saving it to memory to prevent unnecessary wear of SSD drives, The method sizeInBytes() only gives the formated and resized file size of the image but I'd like to get the file size after saving the image with a given "Quality".
Is there such a function that does that without saving the compressed image on memory, or atleast something that saved the output to ram temporary and allow measurement from there?
-
Hi,
AFAIK, no.
What you can do is use a RAM disk as target and then move the file on your disk when satisfied.
-
@ChrisW67 nice ! I forgot about this one and it is even better than what I had I mind !
The QImage::save overload has a code snippet that shows how to do it.
-
@ChrisW67 said in Function that return the file size of a formated resized AND copressed QImage before save()?:
@SGaist said:
it is even better than what I had I mind
It is all roses until someone feeds you a 3.5GB image file or two.
On 32 bit variant of the application ? :-)