RGB Combine odd behaviour -

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
markmarques
Posts: 88
Joined: 2010-06-29T14:36:09-07:00
Authentication code: 8675308

RGB Combine odd behaviour -

Post by markmarques »

According to the docs If I tried separating an image channels and then combined them I should get the "original" image ...
So I tried something like :


convert image1-jpg -monitor -colorspace RGB
( -clone 0 -channel R -separate )
( -clone 0 -channel G -separate )
( -clone 0 -channel B -separate )
-delete 0 -combine image1_a.jpg

instead of the "original" image I get a strange result image ( similar to the original but wrong colors ) ( yellowish image)

tried with the "rose: example" with the same results ( strong yellow image) ...

using Windows 6.7.0-10 "Manual compiled" convert.exe Q32 and HDRI

What am I doing wrong ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB Combine odd behaviour -

Post by fmw42 »

Does your jpg have profiles?

Look at identify -verbose yourimage.jpg

If so, then they are probably lost when you do the separate and then combine.

can you post a link to your jpg file for others to review?
markmarques
Posts: 88
Joined: 2010-06-29T14:36:09-07:00
Authentication code: 8675308

Re: RGB Combine odd behaviour -

Post by markmarques »

To avoid the JPG profile issues I tried with the internal rose: ...
and I suppose the problem is related with this:
convert rose: ( -channel R -separate ) ( -channel G -separate ) ( -channel B -separate ) -combine rose3.png

after some more tests I realised that the combine operator is "adding" all images including the initial one !!

So my further question is how can I make the "combine" command ignore the initial file ?
Or do I have to call convert for each separated channel , save into a file ( MIFF ) and "combine" them at the end ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB Combine odd behaviour -

Post by fmw42 »

convert rose: -separate -combine rose1.png

compare -metric rmse rose: rose1.png null:
0 (0)


convert rose: -channel rgb \
\( -clone 0 -channel R -separate \) \
\( -clone 0 -channel G -separate \) \
\( -clone 0 -channel B -separate \) \
-delete 0 -channel rgb -combine rose2.png

compare -metric rmse rose: rose2.png null:
0 (0)


be sure the add -channel rgb in both places in the second form (or at least just before the -combine)
Post Reply