Perspective distort and losing part of the image
Posted: 2007-11-06T12:54:42-07:00
As I read it with the perspective distort ( and other distort methods ) if part of the image is outside the original it is lost.
I am trying to make a "cube" and I can get the 2 sides with shear OK but I am using perspective distort for the top and it is not working.
Is there a way around this ? I wonder if I should shear it first then distort it ?
I am trying to make a "cube" and I can get the 2 sides with shear OK but I am using perspective distort for the top and it is not working.
Is there a way around this ? I wonder if I should shear it first then distort it ?
Code: Select all
<?php
// Distort the images to use
exec("convert src.jpg -background none -shear 0x20 shear_y1.png ");
exec("convert src.jpg -background none -shear 0x160 shear_y2.png ");
exec("convert -background none -gravity Center shear_y1.png shear_y2.png +append output_shear.png");
exec("convert src.jpg -matte -background none -virtual-pixel background -distort Perspective '0,0 0,239, 319,239, 319,0, 0,0 300,100, 600,0, 300,-100' -trim car4.png");
// Join the first 2 images along the longest edge
exec("convert -background none -gravity Center shear_y1.png shear_y2.png +append output_shear.png");
// Composite the top image
exec("convert -size 700x700 xc:none output_shear.png -gravity center -composite car4.png -geometry -140-115 -composite -trim output_shear1.png");
?>