0

When I Use:

imagecreatefromjpeg() and the $path parameter is a URL. I save the jpeg at 100 compression... Yet I still get slight quality loss...

Is there a way to prevent this?

AlexMorley-Finch
  • 6,785
  • 15
  • 68
  • 103

2 Answers2

3

There is always a loss in quality when you re-save a jpeg image, you should instead copy the image file.

Mads Lee Jensen
  • 4,570
  • 5
  • 36
  • 53
  • Yep that's right. Save a Jpeg at 100 compression a few times and you'll have a garbled unrecognisable mess, doesn't matter whether it's GD or Photoshop it's the nature of a lossy image format. – m4rc May 23 '12 at 13:12
  • In general jpeg compression with quality 100 should not be used. The files are very large, yet they are still lossy, and there is very little noticeable visible difference between 100 and 90 or even 80. Use PNG for image type that supports lossless compression. – Marcus Adams May 23 '12 at 13:33
  • I just did the test, and photoshop doesn't loose any quality if saved to maximum, and I compared two files at 60% quality, and the photoshop one was a way smaller and less bad looking. I just built something with PHP GD and it's horrible even with an 100% compression. – Guillaume Chevalier Aug 13 '13 at 01:49
1

all jpg images will have artifacts, no matter the compression. if this is a picture with lots of colors and no real sharp edges it shouldnt be a problem, however if its a logo or something where edges are important you should consider using the PNG alternative.

Highstrike
  • 462
  • 3
  • 14