Page 1 of 1
Please use CIE LCH for transfer modes Colorize, Luminize etc
Posted: 2010-07-26T10:02:17-07:00
by KonfuseKitty
As soon as I started using Colorize and Luminize transfer modes that ImageMagick provides, I noticed that the output is of the same rather poor quality as Color and Value transfer modes in GIMP 2.6.8, the current stable version. I use Colorize for reducing colour noise, by blurring a copy of the image and merging it with the original using Colorize. However, the procedure accentuates luminance noise. I joined up with the Gimp developer mailing list, posted about it, and was directed to this bug report:
http://bugzilla.gnome.org/show_bug.cgi?id=325564
It is clear from the discussion in the comments of the bug report, and from the samples that the posters provided, that better results are achieved if the CIE LCH mode is used for these transfer modes. If you read that discussion, you will note that the bug is considered fixed, since GIMP is moving to using GEGL projection, which does use CIE LCH.
So I'd like to make a plea to the ImageMagick developers to effect a similar improvement in IM. It is a sad fact, that at this point in time, as we wait for the next stable release of GIMP, there is simply no application on Linux that offers a correctly functioning Color(ize) transfer mode. Krita suffers from the same problem.
Thank you for listening!
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T09:40:59-07:00
by KonfuseKitty
I've been able to hack a useable workaround:
Code: Select all
convert test.tif -colorspace lab -channel r -separate test-L.tif
convert test-L.tif \( test.tif -gaussian-blur 0x2 -colorspace lab -separate \) -delete 1 -set colorspace lab -channel rgb -combine -colorspace rgb - | display -
As you can see, this takes the image where I want to reduce colour noise and saves out the L component of its Lab colour space; then, after blurring the original RGB image, combines the blurred A and B Lab components with the saved non-blurred L component. It produces the correct result, it doesn't accentuate luma noise, even at very high blur settings.
Still, it would be good if Colorize and Luminize (from different ends of the string, so to speak) performed the feat. It would be faster as it wouldn't entail writing the initial L component to disk. I haven't been able to avoid that.
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T09:53:06-07:00
by fmw42
try this
convert tmp.tif \
\( -clone 0 -colorspace lab -channel r -separate \) \
\( -clone 0 -gaussian-blur 0x2 -colorspace lab -separate -delete 0 \) \
-delete 0 -set colorspace lab -channel rgb -combine - | display -
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T11:31:17-07:00
by KonfuseKitty
Thank you, the script looked promising as I hadn't tried the -delete 0 within the parenthesis, but I'm afraid I get the same result as with my previous attempts: a slightly sepia tinted grayscale image. Does it work correctly for you? I'm using IM 6.6.2-6 Q16.
Edit: the output is cyan with the script as is, sepia grayscale if I end it with ... "-combine -colorspace rgb - | display -"
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T11:57:28-07:00
by fmw42
It was interesting with the example I tried, if I used ... -combine - | display -, I got sepia, but if I used ... -combine show:, I got cyan.
If I just save a file, I get the same sepia tone result.
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T12:18:42-07:00
by fmw42
This is the correction. I forgot the -respect-parenthesis
convert test.tif -respect-parenthesis \
\( -clone 0 -colorspace lab -channel r -separate \) \
\( -clone 0 -gaussian-blur 0x2 -colorspace lab -separate -delete 0 \) \
-delete 0 -set colorspace lab -combine -colorspace rgb show:
Or replace show: with miff:- | display -
By the way, your -channel rgb before the combine is not needed.
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T12:57:16-07:00
by KonfuseKitty
Beautiful! Just the kind of automagic I like... thank you!
Hang on though, does that mean Colorize/Luminize now won't be improved?
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T14:33:37-07:00
by fmw42
Sorry, I cannot answer that. I don't make those kinds of decisions. I just try to help answer questions where I think I know the answer. (Not always right, though).
P.Sl I hope you noticed my reply to your post at
viewtopic.php?f=2&t=16651
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-27T21:30:41-07:00
by anthony
KonfuseKitty wrote:Beautiful! Just the kind of automagic I like... thank you!
Hang on though, does that mean Colorize/Luminize now won't be improved?
It will get improved if you can get someone to recode it, so as to improve it. Simple as that.
ImageMagick is open source.
These were about the only parts of Compose I have not worked on. The code for them is in "magick/compose.c". Go for it.
Re: Please use CIE LCH for transfer modes Colorize, Luminize
Posted: 2010-07-28T00:19:56-07:00
by KonfuseKitty
I truly wish I could contribute code, alas, I'm not capable of learning a language such as C or C++. Every time I tried I fell into a coma!
I dream of an application, a high level language, that could be used to easily create code, and then the application would translate it into a lower level language such as C etc. Does such an application exist? If only!
Thanks for listening though, it's appreciated. I'll see if I can find a coder somewhere and interest them in working on a fix. You never know, stranger things have happened.