New QImage formats for higher bit depths?
-
Qt has always had good features for image loading, display, and basic processing. Its painless support for a wide range of image formats is extremely useful. Qt does not, however, support 16-bit gray images or 48-bit RGB images. I know that such support has been requested through a bug report before, and that this report was closed in 2006 as "off topic". However, times have changed since then, and high bit-depth images are getting much more common. I am also aware that there is a library developed by the Krita community that handles high bit-depth images. However, I believe that it would be much more convenient if Qt's QImage class could handle these directly.
I propose to add such support in a number of stages and hereby seek comments. I am brand new to the Qt development community—although I have used Qt for the development of open-source software for 15 years—so I appreciate your patience if I appear naive.
1.a. I will extend the QImage::Format enum to include formats QImage::Format_Gray16, QImage::Format_RGB48, and QImage::Format_ARGB64. (Further deep formats could be added later.)
1.b. I will create format conversion functionality for these formats to all other formats, which will initially run through Format_Indexed8, Format_RGB32, and Format_ARGB32 respectively. (Direct conversion to and from Format_BGR30 and friends is obviously desirable too.)
1.c. Drawing into such QImages with QPainter will not initially be supported. (It is interesting, but not urgent, and even drawing into the existing 30-bit formats has limited support at the moment.)- I will make sure that QPixmap and other users of QImage handle the new formats correctly. Since 8 bits per channel is the norm throughout Qt, it will be enough to downconvert to 8 bits in the initial implementation.
3.a. I will begin by adding support for 16-bit gray images in the PGM handlers for QImageReader and QImageWriter, and for 48-bit RGB images to the PPM handlers, since this is the easiest target.
3.b. Support for deep PNG and deep TIFF images is the obvious next step.
3.c. Support for some HDR formats may be attractive in the future, but probably better through the Qt Image Formats module.If done in this order, each step can proceed without causing problems in other parts of Qt. Since I am new to the project, I think it would be best for me to post relatively small patches that someone more senior could look at without too great a time burden.
I am adding a poll to gauge interest in this proposal and I am very much open to comments and suggestions.
-
Hi, and welcome to the Qt Dev Net!
I haven't used high bit depth formats myself, but if you are right about their increasing popularity, then I'm sure people would appreciate the contribution.
On this forum, you will find developers who use Qt. These devs can provide you feedback on what they might look for in your new features.
I recommend that you also post your proposal to the "Development mailing list":http://lists.qt-project.org/mailman/listinfo/development (you need to subscribe to the list first). There, you will find developers who work on Qt. These devs can provide you feedback on how to go about implementing your new features, and if there are any technical restrictions you need to be aware of.
[quote author="wagenaar" date="1418843547"]If done in this order, each step can proceed without causing problems in other parts of Qt. Since I am new to the project, I think it would be best for me to post relatively small patches that someone more senior could look at without too great a time burden.[/quote]Yes, each git commit should be a small, "atomic" patch. This rule applies to all contributors, regardless of how senior they are.
Anyway, discuss your plan on the Development mailing list as I mentioned before. Work out with the Qt engineers whether you should push a series of commits directly into the "dev" branch, or push to your own feature branch first and then merge it back into "dev" when ready.
[quote author="wagenaar" date="1418843547"]I am brand new to the Qt development community—although I have used Qt for the development of open-source software for 15 years—so I appreciate your patience if I appear naive.[/quote]Again, welcome! I think your proposal is sensible, mature, and professional.