[英]How to get image blob from ImageMagick convert command in php
通过PHP的shell_exec()
使用ImageMagick convert
,可以获得二进制blob。 将这样的命令转换为PHP Imagick类非常困难。 有没有其他方法可以实现此功能?
我正在这样使用Imagick。
$im = new Imagick('some image');
$im->trimImage(20000);
header ("Content-Type: image/{$im->getImageFormat()}");
echo $im->getImageBlob(); // need output in from of blob
我想要得到类似的输出结果。
convert imageName.png -alpha set - white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" -shave 1x1 removed_edges.png
如果ImageMagick命令返回二进制blob而不是将其写入文件,则将解决我的问题。
附加的jpg:-在命令后而不是图像名称,并且可以正常工作。
$command = "convert imageName.png -alpha set - white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" -shave 1x1 jpg:-"; header ("Content-Type: image/jpg"); echo shell_exec($command);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.