Does anyone have a work around for this? I think that the image is already optimised. It then get's resized and it sheds its optimization and despite the picture being made narrowly smaller. The file size increases.
Has anyone come across this before.
I have an image that was saved at 50% quality. If I copy -> resize -> save at 70% it gains 80Kb..
Is there a solution which allows me to detect the quality of the image before it goes in?
function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagesavealpha($new_image, true);
$trans_colour = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
imagefill($new_image, 0, 0, $trans_colour);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
...
imagejpeg($this->image,$filename,$compression);