Skip to content

Commit b8b7be8

Browse files
author
Oleksii Korshenko
committed
MAGETWO-65006: [GitHub][PR] Keep transparency when resizing images #7307
- fix is created based on public pull request #7307 by @kassner - closing #7307
1 parent f59e74c commit b8b7be8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/internal/Magento/Framework/Image/Adapter/Gd2.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ public function resize($frameWidth = null, $frameHeight = null)
346346
$newImage = imagecreate($dims['frame']['width'], $dims['frame']['height']);
347347
}
348348

349+
if ($isAlpha) {
350+
$this->_saveAlpha($newImage);
351+
}
352+
349353
// fill new image with required color
350354
$this->_fillBackgroundColor($newImage);
351355

lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ public function resize($frameWidth = null, $frameHeight = null)
168168
);
169169
}
170170

171+
$newImage->compositeImage(
172+
$this->_imageHandler,
173+
\Imagick::COMPOSITE_COPYOPACITY,
174+
$dims['dst']['x'],
175+
$dims['dst']['y']
176+
);
177+
171178
$newImage->compositeImage(
172179
$this->_imageHandler,
173180
\Imagick::COMPOSITE_OVER,

0 commit comments

Comments
 (0)