image icon indicating copy to clipboard operation
image copied to clipboard

Encoding from existing JPG to JPG significantly increases file size

Open ToshY opened this issue 4 years ago • 0 comments

I've just noticed that using the encode method increases the file size significantly if you try to encode a JPG to JPG.

Example:

$image = $this->image->make($originalJpgImage);
$imageJpgEncoded = (string)$image->encode('jpg',100);

Results with GD:

  • Original: 42 KB
  • Encoded: 112 KB

Results with Imagick:

  • Original: 42 KB
  • Encoded: 61 KB

Setting the quality 80 gets me decently close to the original file size, but I fail to understand what is causing such an increase. Could someone elaborate on why this is happening? And is this normal behavior?

ToshY avatar Nov 21 '21 22:11 ToshY