-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
Currently, all thumbnails created by the image api create JPEGs, no matter what the original picture type is. This is counterproductive, e.g. transparency and sharpness of PNGs are lost.
For a discussion regarding this, see
http://forums.reprap.org/read.php?33,254970,255152#msg-255152
A patch fixing the issue for the 'convert' method is surprisingly simple, it actually removes code:
--- image.php.2013-10-15 2013-10-13 18:58:17.000000000 -0700
+++ image.php 2013-10-15 04:21:32.000000000 -0700
@@ -298,7 +298,9 @@
$cmd = escapeshellcmd($convert) . ' ' .
'- ' .
'-thumbnail ' . $img['new_w'] .'x'. $img['new_h'] . ' ' .
- '-write jpeg:- ' .
+ // Keep the image format. --Traumflug 2013-10-15
+ //'-write jpeg:- ' .
+ '-write - ' .
// Using '--' produces "permission denied for file --".
// Actually, convert (tries to) write two files, then,
// one to stdout and one to $PWD/--. To avoid this,
@@ -336,7 +338,8 @@
if ($exit == 0) {
$img['image'] = $scaled;
- $img['new_mime'] = 'image/jpeg';
+ // We keep the image type now. --Traumflug 2013-10-15
+ //$img['new_mime'] = 'image/jpeg';
$img['method'] = 'convert';
return $img;
The code surrounding the patch might not fit the standard code, because we need a workaround for a 'convert' bug. Nevertheless I think the idea of the patch is visible and easy to apply manually.
Further simplification might be a good idea, like the entire removal of the 'new_mime' variable. I can't see a point in changing mime types.
Reactions are currently unavailable