Gamma-correct image scaling 2011-05-09
I recently heard of Eric Brasseur’s article Gamma error in picture scaling. The news that many graphics tools including the GIMP hurt certain colors during image scaling was rather surprising to me.
I was actually looking a command line tool to that job right out of the box — any recommendations besides ImageMagick/convert or netpbm/pamscale? — but I ended up writing a pygimp-based GIMP plugin yesterday. It does the job and comes with a simple GUI. Compared to core GIMP, the speed is quite disappointing though, probably because of using Python (and an extra layer) but C code.

Once you have the plugin installed
# sudo layman -a betagarden # sudo emerge -av media-plugins/gimp-imagescaler
you should find an item “Scale Image with correct Gamma…” at the bottom of the “Image” menu.

The code is free software, clean patches are welcome:

The Gamma-correct image scaling by Sebastian Pipping, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.







Hmm. Makes me wonder, if there’s basically a fix in the form of a plugin, why isn’t it implemented in gimp’s scaler itself? either way, thanks for sharing, I didn’t know about this at all.
Valid question. Let me reply by pointing to this GIMP bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=168022
Thanks
hopefully this gets into GIMP itself. GEGL’s scheduled to arrive in a looong time, so having a working implementation in 2.6, heck even 2.7 would be great.
How about media-gfx/imageworsener?
Actually that tool was what lead me to the article in the first. I lost the name of the tool somehow and were actually looking for it since then. So thanks for bringing it back!
Yeah, OS graphics is in a sad state. Even if GIMP manages it, e.g. XRender impls usually don’t respect this issue. The only tool I discovered so far is (tadaaa!…)
http://netpbm.sourceforge.net/doc/pamscale.html
That GIMP bug is exemplary of the widespread confusiuon surrounding the issue – I’m working on some graphics-related project and no one has a clue. It’s not set to improve soon.
pamscale is part of netpbm, which I mentioned in the post. I will change it to netpbm/pamscale now.
Have you checked media-gfx/imageworsener? It seems to do the right thing.
Ah, sorry I assumed people naturally turn to pnmscale when they talk about netpbm – which of course is broken.
WRT imageworsener – that is really a cool tool. But as it happens I wrote a cool tool myself (diploma thesis) and so I never really had the pressure to look for imageworsener or the like.