LWN.net Logo

Using GIMP without losing colour depth

Using GIMP without losing colour depth

Posted Apr 17, 2012 19:51 UTC (Tue) by rgmoore (✭ supporter ✭, #75)
In reply to: Using GIMP without losing colour depth by epa
Parent article: Natterer: Goat Invasion in GIMP

As I understand it, one of the major points of GEGL is that it is able to apply changes nondestructively, so you'll only be at risk of irreversibly converting your data to 8-bit/channel when you flatten it for export. IIRC, this is supported by a major change in GIMP behavior: in 2.8, GIMP will only save files in its own format, with other formats requiring an explicit export step.


(Log in to post comments)

Using GIMP without losing colour depth

Posted Apr 17, 2012 23:42 UTC (Tue) by zlynx (subscriber, #2285) [Link]

But is there any risk that running a plugin will read 24-bits per channel data, convert it to 8 per, run the plugin operation and write it back as 8 per?

Using GIMP without losing colour depth

Posted Apr 18, 2012 3:46 UTC (Wed) by PaulWay (✭ supporter ✭, #45600) [Link]

Unless you're dealing with images that are far beyond the needs of mortals, I suspect you mean 24-bit images (usually 8-bit RGB) rather than 24-bits-per-channel.

Mind you, I suspect that you could still get 'photophile' photographers to buy a camera that claimed a 2^72 point colour space and 2^24 alpha levels. It'd go beside the $2400/meter oxygen-free monodirectional pure copper stereo cables (http://www.dontgoto.stereotimes.com/cable110107.shtml) and the purple hologram bracelet to "improve your energy" (http://www.alsodontlookat.myimprovebalance.com/our-balanc...).

Have fun,

Paul

Using GIMP without losing colour depth

Posted Apr 18, 2012 4:41 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link]

>Unless you're dealing with images that are far beyond the needs of mortals, I suspect you mean 24-bit images (usually 8-bit RGB) rather than 24-bits-per-channel.

No. He means EXACTLY images with 16-24 bits per channel.

And please, stop scoffing.

While 16 bits per channel is indeed a much bigger dynamic range than you can see (never mind display) at once, higher dynamic range allows you to increase contrast without visually losing information.

That comes in VERY handy when you need, for example, to make photos in the dark with some bright objects present. That allows to achieve HDR-like effects using a single image: http://en.wikipedia.org/wiki/High_dynamic_range_imaging#E... - something like this.

Using GIMP without losing colour depth

Posted Apr 18, 2012 14:26 UTC (Wed) by gmaxwell (subscriber, #30048) [Link]

Uh. The eye's instant dynamic range is more like 12bits in luma. We get by with 8 bits because the nonlinear response puts the noise where its least noticeable. But 8 bpc still obviously bands— 10bpc nonlinear is a big improvement and it's really unfortunate that there is ~no progress in the direction of supporting this in the free software world.

Considering long term adaptation human vision has more like 20 bits of luminance dynamic range.

Using GIMP without losing colour depth

Posted Apr 18, 2012 4:57 UTC (Wed) by Imroy (guest, #62286) [Link]

1. Yes, many digital cameras produce RAW files with greater than 8 bits per component. And many scanners (especially dedicated film scanners) produce images with greater than 8 bits per component.

2. Wide colour gamuts, as used by many cameras and scanners, require greater bit depths to avoid posterization.

3. If you're going to be manipulating an image, being limited to 8 bit components risks posterization e.g when adjusting brightness/contrast/curves. Even if your source is only 24-bit, you should still use greater depth when manipulating them (in memory or temporary files on disk). We are, after all, talking about an image editor here.

Using GIMP without losing colour depth

Posted Apr 18, 2012 5:00 UTC (Wed) by rgmoore (✭ supporter ✭, #75) [Link]

I've never heard of 24 bits per channel, but 16 bits per channel is what most photographers would like to use these days, and 32 bit floating point per channel seems to be common for HDR images. While 8 bits per channel with a gamma curve may be fine for display purposes, it's not good enough for editing. Applying a strong contrast correction to 8 bit per channel data will result in really ugly posterization or (if you try to correct for it) obvious dithering. You want more bits of color depth than your capture device can provide so any round-off errors will be of noise rather than signal.

Floating point

Posted Apr 18, 2012 9:23 UTC (Wed) by tialaramex (subscriber, #21167) [Link]

In the audio chain we see 24-bit recordings (for headroom) processed in 32-bit single precision floating point and then mixed down to 16-bit for publication (e.g. CDs)

The rough equivalent in video / photography would be 16-bit raw images (again for headroom) processed to 16-bit half precision floating point (almost the same precision as 12-bit integer but far larger range) with 8-bit published image data. However although GPUs often accelerated halfs, most CPUs do not so far as I know, and so GIMP's native operations would be hamstrung on most computers if it used half precision as its internal representation. That might argue for using 32-bit floats even though they're probably overkill.

Using GIMP without losing colour depth

Posted Apr 18, 2012 9:54 UTC (Wed) by farnz (guest, #17727) [Link]

No, he probably does mean 24 bits per channel. While the human eye can't see the graduations at that depth, processing signals (whether images or sounds) accumulates artifacts in the least significant bits.

By using an insanely high bit depth during editing, you can ensure that the processing artifacts are all in the bit of the signal you're going to discard for final output (at typically 12 bits per channel for cinema, 8 bits per channel for computers or TV).

For much the same reason, pro audio work typically starts with a 24 bit sample (where the bottom 2-4 bits are typically noise from the ADC process), works with 32 bit floats, and downsamples to 16 bit for final output.

Using GIMP without losing colour depth

Posted Apr 18, 2012 17:56 UTC (Wed) by lenov (guest, #15428) [Link]

This whole thread suggests that image treatment software are only for processing images aimed at human eyes. High quality CCD used in scientific research record very high dynamics. Having 65536 levels of intensity is very different from having 256 when analysing signals. This is why you will find 100% of biologists using Photoshop, even when, like me, they use Linux and The Gimp for presentations etc.

Using GIMP without losing colour depth

Posted Apr 20, 2012 21:50 UTC (Fri) by rgmoore (✭ supporter ✭, #75) [Link]

If you want more bits while sticking to FOSS, you could try Cinepaint instead of GIMP. It handles color in 16 bit per channel linear and 32 bit per channel floating point formats. It's mostly aimed at the movie industry, but it should work OK for other images that need higher precision.

Using GIMP without losing colour depth

Posted Apr 22, 2012 20:17 UTC (Sun) by jospoortvliet (subscriber, #33164) [Link]

in that case i would rather go krita. While, like cinepaint, krita is not aiming for image editing but rather creating, that seems closer to the purpose of GIMP than cinepaint aiming at movie stuff. I would however try both as have no experience with cinepaint..

Using GIMP without losing colour depth

Posted Apr 18, 2012 5:03 UTC (Wed) by rgmoore (✭ supporter ✭, #75) [Link]

Reading the article, it sounds as if plugins will have to be rewritten to take advantage of GEGL or you'll see exactly the kind of flattening of high bit depth images you're worried about. The good news is that it sounds as if porting them shouldn't be too hard.

Using GIMP without losing colour depth

Posted Apr 18, 2012 9:44 UTC (Wed) by tialaramex (subscriber, #21167) [Link]

It's not clear whether it can happen by accident though. In GIMP traditionally a plugin registers itself according to which pixel formats it can process. A plugin which doesn't make sense on RGB data (e.g. it does some operation on image palettes) is then not directly available to be used until you convert the image to a form where that plugin does make sense. So you can't accidentally make your photograph into a palette based image without realising that's what will happen. Previously plugins which save image data would offer to create a copy of the image and convert that if necessary (e.g. if you save your photograph as a GIF) rather than damage the original. I believe GIMP now forces users to "export" images to all formats other than its own native format, making this more explicit.

If the new GEGL integration just adds to the list of pixel formats then options provided by today's plugins will just be greyed out signalling that you can only use them after converting down to 8 bits per channel. I seem to remember that the popular Photoshop application initially had very few plugins capable of high bitdepth operation and so whole menus would be entirely grey.

On the other hand if GEGL automatically converts then indeed the user will lose all their extra precision the first time they perform an operation implemented by a legacy plugin. That would reduce the user education problem ("Why is plugin X greyed out?") but might hurt confidence in GIMP's data integrity.

Using GIMP without losing colour depth

Posted May 8, 2012 9:19 UTC (Tue) by prokoudine (guest, #41788) [Link]

You are basically asking, what if someone uses a plugin that hasn;t been ported to GEGL yet. The plans is to get rid of such plugins in the bundle and encourage 3rd party developers to port their stuff to GEGL too.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds