【问题标题】:How Margin Image with shadow in imagemagick?如何在imagemagick中使用阴影边缘图像?
【发布时间】:2014-12-08 00:50:36
【问题描述】:

我创建一个图像: Generate a stack of Polaroid-like photos from 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

我的结果:

但我想从背景的 4 侧边距我的结果或填充。

有什么解决办法吗? 谢谢

【问题讨论】:

  • 你能澄清一下你想要达到的目标吗?或者给我们看。究竟是什么问题?
  • 嗨,我的老朋友马克 :) ,我使用 convert -size 500x500 xc:none gfx/gen/tmp.png 创建透明的大文件,并将我的旋转图像与中心合成。我回答我的问题。

标签: php imagemagick margin


【解决方案1】:

像这样创建图片:

你需要使用:

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);

您的结果将像示例一样。 如果您需要更多图像或重复不同的图像,请不要忘记:

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

如果需要,更改 $newfile 或更改 $pic01 .... $pic(n)。 并用 $result_image 组合它,例如:

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

我希望这个使用充分。 最好的问候,谢谢Mark

【讨论】:

    猜你喜欢
    • 2020-10-23
    • 1970-01-01
    • 2014-01-20
    • 2013-02-20
    • 1970-01-01
    • 2021-11-13
    • 1970-01-01
    • 2014-06-05
    • 2018-08-11
    相关资源
    最近更新 更多