@@ -194,7 +194,8 @@ protected function prepareZoomBaseImages(string $image_path, string $out_path):v
194194 // resizeImage - works slower but offers better quality
195195 : $ il ->resizeImage ($ w , $ h , $ this ->options ->resize_filter , $ this ->options ->resize_blur );
196196
197- $ this ->saveImage ($ il , $ base_image );
197+ // save without optimizing
198+ $ this ->saveImage ($ il , $ base_image , false );
198199
199200 if ($ start ){
200201 $ this ->clearImage ($ im );
@@ -265,7 +266,7 @@ protected function createTilesForZoom(Imagick $im, int $zoom, string $out_path,
265266 $ ti ->extentImage ($ ts , $ ts , 0 , $ th );
266267 }
267268
268- $ this ->saveImage ($ ti , $ tile , $ optimizer );
269+ $ this ->saveImage ($ ti , $ tile , true );
269270 $ this ->clearImage ($ ti );
270271 }
271272
@@ -280,13 +281,14 @@ protected function createTilesForZoom(Imagick $im, int $zoom, string $out_path,
280281 /**
281282 * save image in to destination
282283 *
283- * @param Imagick $image
284- * @param string $dest full path with file name
284+ * @param Imagick $image
285+ * @param string $dest full path with file name
286+ * @param bool $optimize
285287 *
286288 * @return void
287289 * @throws \chillerlan\Imagetiler\ImagetilerException
288290 */
289- protected function saveImage (Imagick $ image , string $ dest ):void {
291+ protected function saveImage (Imagick $ image , string $ dest, bool $ optimize ):void {
290292 $ dir = dirname ($ dest );
291293
292294 if (!is_dir ($ dir )){
@@ -304,7 +306,7 @@ protected function saveImage(Imagick $image, string $dest):void{
304306 throw new ImagetilerException ('cannot save image ' .$ dest );
305307 }
306308
307- if ($ this ->options ->optimize_output && $ this ->optimizer instanceof Optimizer){
309+ if ($ this ->options ->optimize_output && $ optimize && $ this ->optimizer instanceof Optimizer){
308310 $ this ->optimizer ->optimize ($ dest );
309311 }
310312
0 commit comments