Negate during composite

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
kamil
Posts: 9
Joined: 2018-04-26T01:26:37-07:00
Authentication code: 1152

Negate during composite

Post by kamil »

Hello, I trying learn somethink but i get stuck. Im using Windows cmd and ImageMagick 7.0.8-4 Q16 x64 2018-07-03;
What im trying do is negate black pixel to white during my process, But when im doing this my whole result is negatived.
This is my command

Code: Select all

cmd /c  convert ( "\mockupImages\Backpack_black.jpg" ) ^ "\D0-1999\162 - Alien head (pocket)\-W-.png" -geometry 582.0829986613119x740.4979919678715+989.1880856760375+832.5997322623829  -composite "D:\out.jpg"
How can i only negate -W-.png not whole file.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Negate during composite

Post by snibgo »

The first pair of parentheses does nothing, and can be removed.

To negate just the second image, put it in parentheses with "-negate":

Code: Select all

cmd /c convert "\mockupImages\Backpack_black.jpg"  ^ ( "\D0-1999\162 - Alien head (pocket)\-W-.png" -negate ) -geometry 582.0829986613119x740.4979919678715+989.1880856760375+832.5997322623829 -composite "D:\out.jpg" 
snibgo's IM pages: im.snibgo.com
kamil
Posts: 9
Joined: 2018-04-26T01:26:37-07:00
Authentication code: 1152

Re: Negate during composite

Post by kamil »

it works and not works ;) even if i put "-background none" in ( "W.png" -background none -negate ) result same.
its my design
Image
and this is my result
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Negate during composite

Post by snibgo »

For v7, I suggest you use "magick", not "convert".

You want to restrict the negation to the RGB channels, not alpha, so:

Code: Select all

... -channel RGB -negate +channel ...
snibgo's IM pages: im.snibgo.com
kamil
Posts: 9
Joined: 2018-04-26T01:26:37-07:00
Authentication code: 1152

Re: Negate during composite

Post by kamil »

Thank you very for help and share of knowledge :) It works now perfectly.
Post Reply