[PyQt] Usage of QImageWriter.supportsOption()

Vincent Vande Vyvre vincent.vandevyvre at swing.be
Thu Nov 29 10:41:52 GMT 2012


I'm trying to see what option is supported by QImageWriter().

A test code:
-----------------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-

from PyQt4.QtGui import QImageWriter, QImageIOHandler

frmts = ['bmp', 'bw', 'eps', 'ico', 'jp2', 'jpg', 'pcx',
                'pgm', 'png', 'ppm', 'rgb', 'rgba', 'sgi', 'tga',
                'tiff', 'xbm', 'xpm', 'xv']

opts = [QImageIOHandler.CompressionRatio, QImageIOHandler.Gamma,
        QImageIOHandler.Quality]

iw = QImageWriter()
for fr in frmts:
    print fr, "\t",
    iw.setFormat(fr)
    for opt in opts:
        print iw.supportsOption(opt),
    print

------------------------------------------------------------------------------------------------------

But, for all formats the options are False:

...
jpg     False False False
pcx     False False False
pgm     False False False
png     False False False
ppm     False False False
tga     False False False
tiff     False False False
...

Python 2.7 > PyQt4 4.9.1
Python 3.3 > PyQt4 4.9.5

Thanks for all advices.


-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>


More information about the PyQt mailing list