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?".
Ariel
Posts: 4 Joined: 2017-09-30T09:52:45-07:00
Authentication code: 1151
Contact:
Post
by Ariel » 2017-09-30T10:14:01-07:00
Hello.
Why result of:
Code: Select all
convert 1.png 2.png -channel r -fx "v.r" -channel g -fx "v.g" -channel b -fx "v.b" 3.png
is not looks like 2.png?
In "3.png" red channel - red channel of "2.png", but
In "3.png" green and blue channel - green and blue channel channel of "1.png"!
Please help.Thanks.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Contact:
Post
by snibgo » 2017-09-30T10:38:22-07:00
Each "-fx" is an operator that replaces all the images in the current list with a result.
So the first "-fx" replaces both your inputs with a single image. The other "-fx" operators have only one input.
Ariel
Posts: 4 Joined: 2017-09-30T09:52:45-07:00
Authentication code: 1151
Contact:
Post
by Ariel » 2017-09-30T10:52:46-07:00
Thank you.
I will use:
Code: Select all
convert 1.png 2.png -channel r -fx "v.r" 2.png -channel g -fx "v.g" 2.png -channel b -fx "v.b" 3.png
Or there is a more correct solution for separate processing channels for two images?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Contact:
Post
by snibgo » 2017-09-30T11:18:43-07:00
You command reads the 2.png file three times. There are many ways to read it only once. For example:
Code: Select all
convert 1.png 2.png +write mpr:NUM2 -channel r -fx "v.r" mpr:NUM2 -channel g -fx "v.g" mpr:NUM2 -channel b -fx "v.b" 3.png
Ariel
Posts: 4 Joined: 2017-09-30T09:52:45-07:00
Authentication code: 1151
Contact:
Post
by Ariel » 2017-09-30T13:23:42-07:00
Thank you. Unfortunately the last option works incorrectly - it sees only red channel from second image too.
Ariel
Posts: 4 Joined: 2017-09-30T09:52:45-07:00
Authentication code: 1151
Contact:
Post
by Ariel » 2017-09-30T13:36:23-07:00
Code: Select all
convert 2.png +write mpr:N2 +delete 1.png mpr:N2 -channel r -fx "v.r" mpr:N2 -channel g -fx "v.g" mpr:N2 -channel b -fx "v.b" 3.png
Now works! tnx.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Contact:
Post
by fmw42 » 2017-10-01T11:39:49-07:00
I am not sure -fx is channel sensitive (-channel). Operations on the channels is done with the suffix .r, .g, .b on u or v. So I suspect that -channel can be removed.
Users browsing this forum: Ahrefs [Bot] , Amazon [Bot] , Bing [Bot] , Google [Bot] , Semrush [Bot] and 6 guests