Page 1 of 1

Question about blending two images

Posted: 2011-10-24T15:27:01-07:00
by wrybread
I'm trying to blend two images, removing the green channel of one of them.

I'm trying to take this image:

Image

And make it look like this:

Image

I'm doing it in Photoshop by laying this over the original image:

Image

And then in Blending Options removing the green channel of that green layer, like this (note the checkbox for Green is unchecked - that's the only change being made on this panel):

Image

Does anyone have any hints about how I might achieve such a thing in ImageMagick?

Thanks for any help.

Re: Question about blending two images

Posted: 2011-10-24T15:47:46-07:00
by fmw42
this should be pretty close

convert Clipboard01.jpg -colorspace gray -auto-level +level-colors black,green1 Clipboard01_test1.jpg

see
http://www.imagemagick.org/Usage/color_ ... vel-colors

Re: Question about blending two images

Posted: 2011-10-24T16:00:08-07:00
by wrybread

Code: Select all

convert Clipboard01.jpg -colorspace gray -auto-level +level-colors black,green1 Clipboard01_test1.jpg
Very close.

Is there some simple way to brighten it a bit? That produces this:

Image

And I'd like to get it closer to this:

Image

Or maybe brightness isn't the method I should be using?

I posted the test image and the target if anyone wants to play with the source images themselves:

http://sinkingsensation.com/stuff/tests/tests.zip

Re: Question about blending two images

Posted: 2011-10-24T17:39:28-07:00
by wrybread
For anyone else coming down this path, this does a pretty good job of finishing the transformation:

Code: Select all

convert test2.jpg -modulate 185% test3.jpg

Re: Question about blending two images

Posted: 2011-10-24T18:25:04-07:00
by fmw42
I think you typed green and it needs to be green1. With green1, I get the same brightness as you had desired.

In IM, pure green is green1.

see
http://www.imagemagick.org/script/color.php


If that does not work, then what version of IM are you using? If old, consider upgrading as it works fine for me using green1 in IM 6.7.3.2 Q16 Mac OSX Tiger. It is possible that you have an old version of IM before -auto-level. If so try using -contrast-stretch 0 in place of -auto-level.

Re: Question about blending two images

Posted: 2011-10-24T18:48:04-07:00
by wrybread
> I think you typed green and it needs to be green1.

Wow and thanks, you're right, I copied it incorrectly. Perfect now.

Re: Question about blending two images

Posted: 2011-10-24T21:58:36-07:00
by anthony
For a 'pure RGB green' I generally recommend using the color name "lime".

The reason "green" is so dark is that it is the SVG defination of "green" and not the X11 defination of "green".

See IM examples, Color Basics, Color Name Conflicts
http://www.imagemagick.org/Usage/color_ ... _conflicts

Re: Question about blending two images

Posted: 2011-10-25T09:12:57-07:00
by fmw42
I believe that lime and green1 are identical. see http://www.imagemagick.org/script/color.php

Re: Question about blending two images

Posted: 2011-10-25T22:08:11-07:00
by anthony
fmw42 wrote:I believe that lime and green1 are identical. see http://www.imagemagick.org/script/color.php
It is.

However color names that are followed by numbers are not generally regarded as a good thing, unless you are actually after a pre-prepared 4 color gradient. For example: khaki1, khaki2, kahki3, kahki4

The main reason for that is that the number '1' color does not always correspond to the X11 color name. In some cases none of the colors in the numbered gradient actually directly match the color without a number. For example "khaki" does not directly match any of the colors "khaki1" to "kahki4" though "khaki" is almost identical to "khaki2".

Code: Select all

convert -list color | grep khaki
khaki                 rgb(240,230,140)                              SVG X11 XPM 
khaki1                rgb(255,246,143)                              X11 
khaki2                rgb(238,230,133)                              X11 
khaki3                rgb(205,198,115)                              X11 
khaki4                rgb(139,134,78)                               X11 
Basically numbered colors are typically avoided, unless you have a specific requirement (which I have never actually seen!). The only exception to this is gray# numbered colors....

ASIDE: gray50 is a perfect 50% gray color, but only if you restrict yourself to 24 bit colors (8 bit depth). It is not the same as a perfect 16 bit depth gray which you can get using gray(50%), whcih can be important for some mathematical image processing such as composition lighting effects, and other image mapping, and FFT.

That is to say even the gray# numbers are not always good enough either!