Is there a way to save image in a different bit depth then the platform display depth ?
-
Is there a way to save image in a different bit depth then the platform display depth ?
-
See QImage::Format
http://qt-project.org/doc/qt-4.8/qimage.html#Format-enum -
The problem is that it only loads the image in this format but when I save it then it saved with the display format and not in the format I specified
-
Works perfectly for me.
@QImage("./test.jpg").convertToFormat(QImage::Format_Mono).save("./test2.bmp");@ -
I used the same way:
@
QImage("./myPic.png").convertToFormat(QImage::Format_ARGB8565_Premultiplied).save("./myPic.png");
@
But when i checked "./myPic.png" depth and format after the conversion it was the same as before (32 bit).
Did you try that? -
Wikipedia says:
bq. PNG supports palette-based images (with palettes of 24-bit RGB or 32-bit RGBA colors), grayscale images (with or without alpha channel), and full-color non-palette-based RGB[A] images (with or without alpha channel)
So I suppose this peculiar format just isn't supported by the PNG standard.
-
Thanks.
Do you know what happens "under the hood" when you use a .png on a 16 bit display device (is there a conversion) ?
-
There has to be a conversion, else, you'd see very funny colors and possibly sheared images. I don't know whether it happens in Qt, in the window system or the display driver. I'm guessing the window system. But you should look into the respective Qt code to see what's really going on.
-
As much as i know, you can save your image to any aviliable format, then you can apply some "image processing component ":http://www.rasteredge.com/dotnet-imaging/image-convert/to get your target.
-
if it only save image in one format. how about we convert image before saving with powerufl tool. in this way you can get a different bit depth image when you finish saving. window system is quite fine to me.
see: "image converter":http://www.rasteredge.com/how-to/winforms-net-imaging/image-converting/ /"image saving control":http://www.rasteredge.com/how-to/winforms-net-imaging/imaging-saving-printing/