Thursday 15 March 2012

php - How Margin Image with shadow in imagemagick? -



php - How Margin Image with shadow in imagemagick? -

i create image with: generate stack of polaroid-like photos existing images using imagemagick

convert \ img-5.jpg -thumbnail 300x200 -bordercolor white -border 10 \ -bordercolor grey60 -border 1 -bordercolor none \ -background none -rotate -4 \ \ \( img-2.jpg -thumbnail 300x200 -bordercolor white -border 10 \ -bordercolor grey60 -border 1 -bordercolor none \ -background none -rotate 6 \ \) \ \ \( img-3.jpg -thumbnail 300x200 -bordercolor white -border 10 \ -bordercolor grey60 -border 1 -bordercolor none \ -background none -rotate -2 \ \) \ \ \( img-1.jpg -thumbnail 300x200 -bordercolor white -border 10 \ -bordercolor grey60 -border 1 -bordercolor none \ -background none -rotate -4 \ \) \ \ \( img-4.jpg -thumbnail 300x200 -bordercolor white -border 10 \ -bordercolor grey60 -border 1 -bordercolor none \ -background none -rotate 4 \ \) \ \ -border 100x80 -gravity center +repage -flatten -trim +repage \ -background black \( +clone -shadow 60x4+4+4 \) +swap -background none \ -flatten stack.png

my result:

but want margin result or padding 4 side of background.

is there solution? give thanks you

to create image :

you need utilize :

exec('convert '.$newfile1.' -thumbnail 300x200 -bordercolor white -border 10 -bordercolor grey60 -border 1 -bordercolor none -background none -rotate 3 '.$pic01.''); exec('convert '.$newfile1.' -thumbnail 300x200 -bordercolor white -border 10 -bordercolor grey60 -border 1 -bordercolor none -background none -rotate -4 '.$pic02.''); exec('convert '.$newfile1.' -thumbnail 300x200 -bordercolor white -border 10 -bordercolor grey60 -border 1 -bordercolor none -background none -rotate 5 '.$pic03.''); exec('convert '.$newfile1.' -thumbnail 300x200 -bordercolor white -border 10 -bordercolor grey60 -border 1 -bordercolor none -background none -rotate -9 '.$pic04.''); exec('convert -size 370x320 xc:none '.$result_image.''); exec("composite -gravity center ".$pic01." ".$result_image." -quality 100 ".$result_image); exec("composite -gravity center ".$pic02." ".$result_image." -quality 100 ".$result_image); exec("composite -gravity center ".$pic03." ".$result_image." -quality 100 ".$result_image); exec("composite -gravity center ".$pic04." ".$result_image." -quality 100 ".$result_image); exec("convert ".$result_image." -background black ( +clone -shadow 100x3+0+0 ) +swap -background none -flatten ".$result_image);

and result example. don't forget if need more image or different images repeat :

exec('convert '.$newfile1.' -thumbnail 300x200 -bordercolor white -border 10 -bordercolor grey60 -border 1 -bordercolor none -background none -rotate 3 '.$pic01.'');

and alter $newfile or alter $pic01 .... $pic(n) if need. , compose $result_image like:

exec("composite -gravity center ".$pic(n)." ".$result_image." -quality 100 ".$result_image);

i hope utilize full. best regard, give thanks mark

php imagemagick margin

No comments:

Post a Comment