Page 1 of 1

IM on OS X: Use mask to split an image

Posted: 2013-02-27T16:07:17-07:00
by antonv
I would like to take an image, apply a checkerboard pattern to it so that the result is two images one having the even squares of the original image + transparency and the other having the odd squares of the original image + transparency.

Re: IM on OS X: Use mask to split an image

Posted: 2013-02-27T17:07:54-07:00
by snibgo
Make the chequerboard in black and white. Then ...

Code: Select all

convert infile ( chequerboard -negate ) -compose CopyOpacity -composite outfile
... will make one output file. For the other, leave off "-negate".

Re: IM on OS X: Use mask to split an image

Posted: 2013-02-27T17:47:29-07:00
by antonv
Thank you!

For posterity... this is how you can make a checkerboard:

Code: Select all

convert -size 640x480 pattern:checkerboard -auto-level +level 0,100% checkerboard.gif

Re: IM on OS X: Use mask to split an image

Posted: 2013-02-27T18:02:10-07:00
by fmw42
convert -size 640x480 pattern:checkerboard -auto-level +level 0,100% checkerboard.gif
There should be no need for +level 0,100%, which is a no-op (does nothing) in this case. It would only be needed if you want to change the checkerboard to something of less contrast if you use values other than 0 and 100%