Results 1 to 13 of 13

Thread: QImage : trouble with save() method

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QImage : trouble with save() method

    Hello All!

    Consider the following simple code example
    //////////////////////////////////////////////////////////////////////
    #include<QtGui>

    int main(int argc, char** argv)
    {
    QImage img("1.png","png");
    assert(img.save("1.jpg","jpg")); // BOOM
    //assert(img.save("1.jpeg","jpeg")); // BOOM
    //assert(img.save("2.png","png")); // Works fine
    }
    //////////////////////////////////////////////////////////////////////

    Can I save my image as JPEG???

    P.S.
    QT-4.0.1
    MinGW gcc-3.4

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    JPEG is comercial format you havent support it in free windows version of qt library
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by krivenok
    Can I save my image as JPEG???
    Make sure you have compiled Qt with JPEG support (configure -qt-libjpeg or configure -system-libjpeg). There should be qjpeg1.dll and libqjpeg1.a in %QTDIR%\plugins\imageformats.

    Quote Originally Posted by zlatko
    JPEG is comercial format you havent support it in free windows version of qt library
    What makes you think so?

  4. #4
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    My %QTDIR%\plugins\imageformats
    -rw-r--r-- 1 krivenok Administ 2150 Feb 21 22:05 libqjpeg1.a
    -rw-r--r-- 1 krivenok Administ 2160 Feb 21 22:05 libqjpegd1.a
    -rw-r--r-- 1 krivenok Administ 2146 Feb 21 22:06 libqmng1.a
    -rw-r--r-- 1 krivenok Administ 2150 Feb 21 22:05 libqmngd1.a
    -rwxr-xr-x 1 krivenok Administ 152576 Feb 21 22:05 qjpeg1.dll
    -rwxr-xr-x 1 krivenok Administ 924773 Feb 21 22:05 qjpegd1.dll
    -rwxr-xr-x 1 krivenok Administ 311808 Feb 21 22:06 qmng1.dll
    -rwxr-xr-x 1 krivenok Administ 1385962 Feb 21 22:05 qmngd1.dll

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    What does QImageWriter::supportedImageFormats() return?

  6. #6
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    It returns:
    bmp
    png
    ppm
    xbm
    xpm

  7. #7
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Maybe JPEG plugin is unavailable?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by krivenok
    It returns:
    bmp
    png
    ppm
    xbm
    xpm
    Strange, I have Qt 4.1.2 and this list also includes "jpeg" and "jpg". Try to copy that qjpeg1.dll to a "imageformats" subdirectory in the directory where your executable is.

  9. #9
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by jacek
    Strange, I have Qt 4.1.2 and this list also includes "jpeg" and "jpg". Try to copy that qjpeg1.dll to a "imageformats" subdirectory in the directory where your executable is.
    No effect

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by krivenok
    No effect
    For some reason it doesn't like that plugin. How did you install Qt?

  11. #11
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by jacek
    What makes you think so?
    It was in interesing arhive for qt3 windows non comercial

    http://lists.trolltech.com/qt-intere...ad00008-0.html
    a life without programming is like an empty bottle

  12. #12
    Join Date
    Jan 2006
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Date of message : Sun, 1 Jul 2001

  13. #13
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QImage : trouble with save() method

    Quote Originally Posted by krivenok
    Date of message : Sun, 1 Jul 2001
    Yes but i dont think that licensed policy changed frequently

    ps. it just IMHO...i actually never try use win free version
    a life without programming is like an empty bottle

Similar Threads

  1. Can't save QImage
    By hvengel in forum Qt Programming
    Replies: 6
    Last Post: 14th June 2008, 21:07
  2. How can I save a QImage object into a SQLite3 database table?
    By danielperaza in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2008, 05:39
  3. Trouble with image painting (QPainter + QImage)
    By krivenok in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2006, 20:25

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.