[Closed] (IM7) Find same pixel in n images

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: (IM7) Find same pixel in n images

Post by fmw42 »

See -set at http://www.imagemagick.org/Usage/masking/#alpha_set. I generally prefer -alpha on, if I know the image has transparency. But it is no always need, unless you have used -alpha off. -alpha set may turn your image opaque if you have already used -alpha off. So unless you have alpha off, just don't include -set, unless you want to give an opaque image a transparent alpha or a transarent image an opaque alpha.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: (IM7) Find same pixel in n images

Post by fmw42 »

But I think we digress. What was our original issue and has it been solved?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: (IM7) Find same pixel in n images

Post by snibgo »

Well... on IM v7.0.2-5 on Windows 8.1, this is what happens:

Code: Select all

%IMG7%magick -size 10x10 xc:White w.png
w.png is opaque white, of course. Let's separate the alpha channel:

Code: Select all

%IMG7%magick w.png -channel A -separate +channel x.png
x.png is black. Huh? The problem (I think) is that under v7, w.png doesn't have an alpha channel. So IM returns zero for that channel that doesn't exist. (I think this is stupid behaviour. If there is no alpha, the image is opaque, so the alpha should be taken as 100%.)

The workaround is to use "-alpha set".

Code: Select all

%IMG7%magick w.png -alpha set -channel A -separate +channel x2.png
Now we get a sensible result. x2.png is white.
snibgo's IM pages: im.snibgo.com
jmac698
Posts: 48
Joined: 2013-12-20T01:57:16-07:00
Authentication code: 6789

Re: [Closed] (IM7) Find same pixel in n images

Post by jmac698 »

Thanks for the help, I processed a few images, but have moved on to a custom solution programmed in Python with a stats package.
Post Reply