Results 1 to 8 of 8

Thread: which Qt widget is best to be used for displaying image of every format ?

  1. #1
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question which Qt widget is best to be used for displaying image of every format ?

    As Of now I am using this way to display an image but I want to be able to use QtWidet that can dislay most kinds of image formats like jog,png,tiff,bmp, dpx, exr, cin etc..

    Qt Code:
    1. self.imageLabel = QtGui.QLabel()
    2. self.imageLabel.setBackgroundRole(QtGui.QPalette.Base)
    3. self.imageLabel.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored)
    4. self.imageLabel.setScaledContents(True)
    5. self.imageLabel.setPixmap(QtGui.QPixmap.fromImage(image))
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    The label can obviously show all images that are available as QPixmap. Since there is a conversion from QImage to QPixmap, it can show all images available as QImage. Which means it can show all images that you have QImage IO plugins for.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:


  4. #3
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    then how do I get dpx, cin and exr plugin to work with QPixmap ?

  5. The following user says thank you to krystosan for this useful post:


  6. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    QPixmap is not directly involved in image I/O, that is what QImage does.

    QImage delegates loading to image I/O plugins. If you can load certain formats but not others then the plugins for those other formats are most likely not installed correctly.
    Check the plugin directories: http://qt-project.org/doc/qt-4.8/dep...t-plugins.html

    Cheers,
    _

  7. #5
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    tif images keep giving this error message while being displayed:
    TIFFReadDirectory: Warning, foo: invalid TIFF directory; tags are not sorted in ascending order.
    for dpx and exr i get
    QPixmap::scaled: Pixmap is a null pixmap

  8. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    Those sound like loading errors.

    The TIFF error suggest that the image data is either corrupt or in a different format than supported by the TIF plugin being used.
    The other could indicate that the respective plugins have not been found.

    Check QImageReader::supportedImageFormats()

    If your formats are not listed, check that the plugins implementing them are available in one of Qt's plugin search paths.

    Cheers,
    _

  9. #7
    Join Date
    Nov 2012
    Posts
    35
    Thanks
    1
    Thanked 7 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    I see these are the one that are available

    ['bmp', 'gif', 'ico', 'jpeg', 'jpg', 'mng', 'pbm', 'pgm', 'png', 'ppm', 'svg', 'svgz', 'tga', 'tif', 'tiff', 'xbm', 'xpm']

  10. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: which Qt widget is best to be used for displaying image of every format ?

    Since there are two image formats starting with "tif" in that list, have you tried both when loading your tif files? Is there a difference in error?

    As for the formats not in the list check that your plugins got installed correctly. See comment #4

    Cheers,
    _

Similar Threads

  1. Help displaying .doc format files in Qt application.
    By notes90 in forum Qt Programming
    Replies: 4
    Last Post: 28th September 2012, 23:43
  2. TIFF image Format
    By dima in forum Qt Programming
    Replies: 7
    Last Post: 13th September 2010, 14:42
  3. How can change image format?
    By electronicboy in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2009, 10:44
  4. Supported image format for QMovie?
    By cookie1909 in forum Newbie
    Replies: 2
    Last Post: 21st April 2009, 08:30
  5. Image format without bounding rect
    By dreamer in forum Qt Programming
    Replies: 5
    Last Post: 30th April 2008, 23:25

Tags for this Thread

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.