Page 1 of 1

Posted: 2006-12-07T12:00:59-07:00
by Bonzo
I cheated a bit :shock: I made your graphic a png with a transparent circle where the picture is to go ?

Then I used the code below to create a background, resize the photo and put them all together. There are so many things you can do but I assume you will need to resize the photo. Anyway I am starting to ramble:

Code: Select all

 <?php
exec("/usr/local/bin/convert -size 800x200 xc:none background.png ");
exec("/usr/local/bin/convert pumpkin.jpg -resize 250x250 pumpkin_small.jpg ");
exec("/usr/local/bin/convert background.png -composite pumpkin_small.jpg -geometry +0+30 -composite header.png -composite output.png ");
?>

<img src="output.png">
http://www.rubblewebs.co.uk/imagemagick ... dunphy.php

With Dst_Out you should be able to "punch out" the circle as Anthony puts it but I couldn't get that to work.

http://redux.imagemagick.org/discourse- ... highlight=

Posted: 2006-12-07T16:47:58-07:00
by Bonzo
I have Dst_Out working now; I was using convert instead of composite :roll:

Posted: 2006-12-07T18:11:05-07:00
by anthony
Bonzo, in it important to get the argument order correct for operations like Dst_Out.

For "composite" the order is source destination
bt it is reversed for easer and more logical use in "convert"

here is the psuedo code.

Code: Select all

    convert   {prepare your destination image -- destination}
                   {prepare your image of the 'hole'  -- source }
                   -geometry {location of hole}  -compose DstOut -composite
                  {further processing or save}
Also not that by tracking what images are in the current image squence (only one after a
-composite) and using parenthesis to handle 'temporary image sequences' you can do
just able ALL your image manipulations all in the same command. This avoids the need for temporary files, and is faster and more accurate as you are not saving images to disk
until you are finished.

I suggest you study the 'Basics' section of IM Examples, especially in regards to the image sequence handling by IM. After that you sould have no more trouble with Alpha compositions in "convert".

Posted: 2006-12-08T12:32:10-07:00
by Bonzo
Thanks for the notes Anthony I will have a look at the ImageMagick basics page again now that I have have had a go at most things. I hate reading things on the monitor so will have to print it out !
I have not done a lot with graphics anyway so things like masks, channels etc. are all new to me.

I had pasted the code above on seperate lines mainly so adunphy could see what each part of the code was doing.

Posted: 2006-12-10T18:55:39-07:00
by anthony
No problem. though you can see what image is in memory at a point in process by adding "-write" operations. Also you can use -identify to output size information of the images at various points in the processing

PS: writing to "x:" displays the image on screen, and paused the operations until you finish looking.