image
image copied to clipboard
Trim problem
Hi
I am trying to use the trim() (with imagick driver), in order to remove the unnecessary transparent space in the image below :
Here's the code that comes with it :
use Intervention\Image\ImageManagerStatic as Image;
Image::configure(['driver' => 'imagick']);
$image = Image::make('public/trim.png')->trim()
->save('public/trimmed.png');
The result of that code, is that I am getting a 1x1 transparent image.
I tried another approch with the trim method, like ->trim('transparent')
or ->trim('transparent', null, 10)
. Solution that I found here : Issue #156
I tried to use other features, like greyscale(), and that works perfectly.
Other informations :
PHP version : 7.1.5 PHP imagick : 3.4.3_2 Imagemagick : 7.0.5-10
I have this problem too. It seems, like the borderImage() method makes the whole image transparent.
$image = new Imagick('/some/image/with/a/transparent/background.png');
$pixel = $image->getImagePixelColor(0, 0);
$image->borderImage($pixel, 1, 1); // now the image is fully transparent :(
//$image->trimImage(0); // -> results in 1x1 image
//$image->setImagePage(0, 0, 0, 0);
$image->writeImage("/tmp/test.png");
i think it happens since imagemagick 7, but im not sure
PHP version : 7.2.1 PHP imagick : 3.4.3 Imagemagick : 7.0.7-21
Same issue as @schelmo.
PHP version: 7.0.27 PHP imagick: 3.4.3 Imagemagick: 7.0.7-22
Downgrading to Imagemagick 6 fixed this issue for me
Still an issue, any solution to this?
@satoved or @ntzm, have you found a solution that uses Imagemagick 7?
Think I'm experiencing this issue as well.
PHP version: 7.4.16 PHP imagick: 3.4.4 Imagemagick: 7.0.11-3 Q16 x86_64
The implementation of this function was rather poor and very resource-hungry. I decided to drop this function in the new version 3 of Intervention Image.