Get the size of jpg file of QImage file before saving it.

  • Hi,

    I could get the target QImage from source QImage by the following snippet.

        QByteArray ba;
        QBuffer buffer(&ba);;
        QImageWriter writer;

    Is there any way which tells me how much kilo byte this jpg file would take up even before I save it to disk?
    I tried to use, but it seems give me the size before jpg compression.

  • Lifetime Qt Champion


    No, because it depends on what your image contains.

    By the way, why are you using such a complicated way to copy data from image_source to image_target ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.