Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the imagick driver to crop and resize a png will create artifacts in the output #1426

Open
mvveggel opened this issue Jan 30, 2025 · 1 comment · May be fixed by #1428
Open

Using the imagick driver to crop and resize a png will create artifacts in the output #1426

mvveggel opened this issue Jan 30, 2025 · 1 comment · May be fixed by #1428

Comments

@mvveggel
Copy link

Describe the bug

When using the Imagick driver to crop and resize an image the output contains artifacts, most noticeable in transparent areas (the transparent area is mostly black with random noise).
This does not happen in version <= 3.10.2
When either crop or resize is skipped the artifacts do not appear

Code Example

$imageManager = new \Intervention\Image\ImageManager(new \Intervention\Image\Drivers\Imagick\Driver());
$image = $imageManager->read('Sample.png');
$image->crop(2200, 1500);
$image->resize(220, 150);
$image->encodeByMediaType(null, 90);
$image->save('SampleCropped.png');

Expected behavior

The image is cropped and resized without adding artifacts

Images

Image
Image

Environment:

  • PHP Version: 8.3
  • OS: Linux (Ubuntu 22)
  • Intervention Image Version: 3.11.0
  • GD or Imagick: Imagick 6.9.11-60
@olivervogel
Copy link
Member

olivervogel commented Jan 30, 2025

Thanks for reporting. I will look into this.

Although I can confirm the error, there is a workaround here. I believe the same result can be achieved with the following call.

$imageManager = new \Intervention\Image\ImageManager(new \Intervention\Image\Drivers\Imagick\Driver());
$image = $imageManager->read('Sample.png');
$image->cover(220, 150);
$image->save('SampleCropped.png');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants