Linda,

I do not know enough about doing things in PHP.  The user Bonzo 
(http://www.rubblewebs.co.uk/imagemagick/)  is more familiar with 
PHP. But  in command line, you can use parentheses to do things 
without creating specific images. You can also use memory mapped 
images to hold temporaries. You can also make clones of images.

See:

http://www.imagemagick.org/Usage/basics/#image_seq
http://www.imagemagick.org/Usage/files/#mpr


convert -size ${width}x${height} gradient:white-black -distort 
perspective "all your control points" -write mpr:image1 +delete 
mpr:image1 -flop -write mpr:image2 mpr:image1 -flop -flip -write 
mpr:image3 mpr:image1 -flip -write mpr:image4 | montage -background 
black mpr:image1 mpr:image2 mpr:image3 mpr:image4 -tile 2x2 -geometry 
+0+0 output.png

You may have to reorder the images as I did not quite follow your scheme below.

Again, I do not know if this works in PHP (as mpr only stays around 
in a single command line which is why I used the pipe). Also I do not 
know about using the pipe shell operator in PHP. You can also use 
append to combine the images.


See

http://www.imagemagick.org/script/command-line-options.php#append

If your image is symmetric then you don't need to create all four, only two.

Try this test. I make a gradient, clone and flop it horizontally and 
append them side by side, then flip a clone of that result vertically 
and append that vertically with the first append.

convert \( -size 100x100 gradient: \) \( +clone -flop \) +append \( 
+clone -flip \) -append tmp.png

You can probably do the same by adding your gradient and perspective 
into the first parenthesis. What I do not know is if you can use 
parenthesis in PHP as I have done in command line.

Fred

>Thanks Fred, that worked perfectly.  Now is there a way to make the 
>images temporary so that only the final montage will be output into 
>my directory?
>
>
>
><?
>$w=50;
>$h=50;
>
>$ax1=0;
>$ay1=0;
>$cx1=0;
>$cy1=$h/5;
>
>$ax2=0;
>$ay2=$h-$h/5;
>$cx2=$w/3;
>$cy2=$h;
>
>$ax3=$w;
>$ay3=$h/3;
>$cx3=$w;
>$cy3=0;
>
>$ax4=$w;
>$ay4=$h;
>$cx4=$w;
>$cy4=$h/5;
>
>$IN="-size \($w\)x\($h\) gradient:white-black";
>$OUT1="temp/gradangle1f.png";
>$OUT2="temp/gradangle2f.png";
>$OUT3="temp/gradangle3f.png";
>$ILLUSTRATE="-distort Perspective '$ax1,$ay1,$cx1,$cy1 
>$ax2,$ay2,$cx2,$cy2 $ax3,$ay3,$cx3,$cy3 $ax4,$ay4,$cx4,$cy4' ";
>$OUT4="temp/gradangle4f.png";
>exec ("/usr/bin/convert $IN $ILLUSTRATE $OUT4");
>exec ("/usr/bin/convert $OUT4 -flop $OUT3");
>exec ("/usr/bin/convert $OUT4 -flop -flip $OUT1");
>exec ("/usr/bin/convert $OUT4 -flip $OUT2");
>exec ("/usr/bin/montage -background black $OUT1 $OUT2 $OUT3 $OUT4 
>-tile 2X2 -geometry +0+0 temp/G140f.png");
>
>print "<a href=temp/G140f.png><img src=temp/G140f.png></a><br>";
>?>
>
>
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to