Results 1 to 5 of 5

Thread: QImage save images with different sizes of original images

  1. #1
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QImage save images with different sizes of original images

    Hi,

    I need help to the understand this:

    Why QImage save a JPEG image with a different size of source file?

    See:

    QImage img("source.jpg"); // size 1.3MB (1.352.640 )
    img.save("target.jpg,"JPG"); // size 374KB

    Why this occours? How I do to save with same size?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QImage save images with different sizes of original images

    Hi, I guess the images are saved with different quality settings try
    Qt Code:
    1. img.save("target.jpg,"JPG", 100);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage save images with different sizes of original images

    So Lykurg ...

    If I save with quality = 100% the size up to 2.1MB. With 50% down to 231KB.

    If I use img.quality() (QImageReader) the result is ever -1.

    See this results:

    Source: 1.352.640 img_0070.jpg

    Size Quailty
    82.066 0%_img.jpg
    102.329 10%_img.jpg
    135.576 20%_img.jpg
    171.828 30%_img.jpg
    205.944 40%_img.jpg
    242.294 50%_img.jpg
    282.935 60%_img.jpg
    347.967 70%_img.jpg
    461.758 80%_img.jpg
    779.266 90%_img.jpg
    2.194.091 100%_img.jpg

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage save images with different sizes of original images

    It is not possible to determine the quality of an already saved jpeg image - you never know how many terms from the cosine transformation have been cut of while saving.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage save images with different sizes of original images

    Hi Wysota,

    Now, I understood

    Thanks

Similar Threads

  1. Loading corrupt jpeg images with QImage
    By mikeee7 in forum Qt Programming
    Replies: 15
    Last Post: 3rd December 2010, 01:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.