Well I do need to convert the image to pixmap to use it in QLabel and draw text on it after opening it
Right now the last problem I'm left with is that when I try to convert back to image before saving I end up either with a clean but 4 bit colour depth image:
bad_bmp.jpg
or a 'damaged' 8 bit image:
good_bmp.jpg
I'm converting by using:
# this gives me an 8 bit image with 'noise'
image = self.label.pixmap().toImage()
image
= image.
convertToFormat(QImage.
Format_Indexed8, Qt.
PreferDither) #produces 4 bit depth without PreferDither
# this gives me an 8 bit image with 'noise'
image = self.label.pixmap().toImage()
image = image.convertToFormat(QImage.Format_Indexed8, Qt.PreferDither) #produces 4 bit depth without PreferDither
To copy to clipboard, switch view to plain text mode
I've also tried using the colour map parameter while converting (values taken from original image) but this makes the image drop to 4 bit colour depth :/
Does anybody know how to solve this?
EDIT:
OR redefining the questions, if it's an easier option:
I can't write on an 8 bit QImage, so I have to convert it to some other format.
How can I convert it, and to which format, and how should I convert it back to 8 bit after writing on it?
Bookmarks