13

Is it possible to preserve image quality when uploading images through Drupal7?

For example, I take this image: http://f.cl.ly/items/0L3j21030C3O2A3x2w0b/thumb.jpg

I upload it using an Imagefield, which has no min/max resolution set, and it looks like this: http://f.cl.ly/items/2B2q2a1H402T1Z1j3w2j/baboon-onesie-costume-thumb.jpeg

So already we're seeing a loss in quality. Then it's displayed using a view, which scales the image (which it should do IF) it's larger than 190x280 (which it isn't), and now it looks like: http://f.cl.ly/items/2n023q1Q331J3E2d3a3I/baboon-onesie-costume-thumb-1.jpeg

The quality difference is massive - there's a huge loss of colours and severe artefact creation around the image edges.

The GD image settings are JPEG quality: 100%.

Is there anything that can be done to prevent this ridiculous loss of quality?

5
  • its the diff of .jpg and .jpeg – monymirza Dec 1 '12 at 8:17
  • adding file type .jpeg may works – monymirza Dec 1 '12 at 8:18
  • I don't know the exact reason but I using ImageMagick (requires a module for D7) with 100% quality setting and I'm not seeing much loss in the resized image's quality. – AyeshK Dec 1 '12 at 9:41
  • Ayesh K is 100% correct and should elaborate on how to do that it would be the correct answer. – ransom bot Dec 1 '12 at 16:22
  • There's no reason why you'd necessarily see a large quality loss. I've never had that issue. – Letharion Dec 3 '12 at 11:13
5

There's two solutions to this. The easiest is:

  • Upload images with a "jpeg" extension instead of a "jpg" extension. For whatever reason, images with a jpeg extension are not mangled by Drupal.

However, the best solution if you have control over your hosting environment is:

1

I had this problem, uploading an image to see it scaled via an imagestyle to a low quality image.

The problem was that within my contact type I had a max image resolution set, that I'd forgotten about.

Removed this from the site, and re uploaded, everything is good.

-4

Under the display settings for content types image field you could set the format to none:original image And a CSS rule to display the image at the desired size

caveat
this probably would lead to problems as users could upload images with extreme max/min image resolutions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.