[SOLVED] Difference Image Masking and Feathering: fails

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
jlpoole

[SOLVED] Difference Image Masking and Feathering: fails

Post by jlpoole »

I'm following the examples at http://www.imagemagick.org/Usage/channels/#mask_diff

I have a png photo, sluggo.png (354 pixels by 502 pixels, 72 dpi). Using sluggo.png, I created a layer in Photoshop and the drew an ellipse, feathering it 30 pixels. I inverted the ellipse, filled the inverted area (exterior of ellipse to the edges of the image) with black, and then exported the image to mask.png -- having the same dimensions and dots per inch as the image it was derived from: sluggo.png.

Goal: create an elliptically cropped image with transparency outside of the ellipse.

Here's the command I used based upon my study of the above link to the section titled "Difference Image Masking and Feathering". It is practically identical to the examples, yet I must be missing something very obvious as it did not produce the desired result:

Code: Select all

convert  sluggo.png mask.png +matte  -compose CopyOpacity -composite output.png
The command ran without incident.

the output.png was blank. I was expecting an oval like framing of sluggo. "Oh No!!!!"

sluggo.png
Image
mask.png
Image
output.png (blank white)
Image

Using ImageMagick for Windows on XP Pro SP 3:

Code: Select all

Version: ImageMagick 6.6.4-2 2010-09-14 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
What have I done wrong?
Last edited by jlpoole on 2010-10-14T01:19:40-07:00, edited 1 time in total.
jlpoole

Re: Difference Image Masking and Feathering: fails

Post by jlpoole »

Problem solved.

I think the problem was in the mask I created. I tried experimenting with creating masks on the fly, as in the examples, and they worked. So, I'm guessing the way I exported the mask from photoshop, e.g. using "Save" rather than exporting and making sure the transparency is activated, makes the difference.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: [SOLVED] Difference Image Masking and Feathering: fails

Post by anthony »

More than likly the mask image contained an alpha channel.

See CopyOpacity Composition
http://www.imagemagick.org/Usage/compose/#copyopacity
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply