Reputation: 140
It is possible to get a binary blob by using ImageMagick convert
via PHP's shell_exec()
. It's very difficult to convert such a command to PHP Imagick class. Is there any alternative way to implement this feature?
I am using Imagick like this.
$im = new Imagick('some image');
$im->trimImage(20000);
header ("Content-Type: image/{$im->getImageFormat()}");
echo $im->getImageBlob(); // need output in from of blob
I want do get output result similar to this.
convert imageName.png -alpha set - white -border 1 -fill none -fuzz 3% -draw "color 0,0 floodfill" -shave 1x1 removed_edges.png
If ImageMagick command returns a binary blob instead of writing to a file, my problems will be solved.
Upvotes: 1
Views: 1519
Reputation: 140
Appended jpg:- after command instead of image name & it's working.
$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);
Upvotes: 2