Hi,

I'm trying to use MagickWand (PHP) to perform a "cookie-cutter" 
operation to change the shape of an image.  My app needs to accept 
rectangular photos, and "cut" them into an elliptical shape by 
clearing all the pixels outside an elliptical region.

The approach I'm using is:

  1. Load one MagickWand object with a mask:  a 1-bit-per-pixel GIF 
file containing an ellipse, drawn with 1's on a background of 
0's.  In case anyone wants to check this, the mask is on-line now at 
http://TheMagicM.com/Merchant2/magick/backgrounds/buckleovalmask.gif .


  2. Load a second MagickWand object with a photo (JPG 
image).  Resize and/or crop it to be the exact same size as the mask.

  3. Perform some type of compositing operation.

#3 is the part I'm having trouble with, and I haven't been able to 
find any documentation that helps.  (If anyone knows of any, just 
give me the link!)

I presume I need to use a command something like:

MagickCompositeImage($mask, $photo, Some_CompositeOp, 0, 0);

But after much trial and error, as well as searching for 
documentation, I'm unable to determine:

  - Are the $mask and $photo parameters correct as shown, or should I 
reverse them?

  - What CompositeOp should I use?

  - Do I need to do something with transparency before the composite, 
and if so, what command(s) should I use for that?

Thanks --

   Kent Multer                  |\  /|
   Magic Metal Productions      | \/ |
   http://TheMagicM.com         |    |

  * Web developer/designer
  * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/ISBN=0966103211/magicmetalproducA

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to