We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Resized Image Quality

Development and Programming

ejectmedia's avatar
ejectmedia
12 posts
17 years ago
ejectmedia's avatar ejectmedia

I’ve got a site set up to resize uploaded images to the appropriate size, but the image quality of these resized seems to be very poor!

This is the slightly larger original image I uploaded, and this is what EE produced from that.

Why is there so much dithering and quality loss? I don’t see any image quality settings anywhere, only the ability to change what image library processes images, and those settings make no difference.

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
17 years ago
Robin Sowell's avatar Robin Sowell

In truth- those results aren’t jumping out as horrible.

The image library generally makes a pretty big difference. GD tends to be not so great- any of the other options would be an improvement. As to quality settings- it depends a bit on where you’re doing the upload. Via the gallery, you can specify the quality settings for both thumb and mid-size images. If it’s via the ‘Publish’ page, looks like it defaults to 90%. You could try overriding to 100%, but really shouldn’t need to.

Still- you could edit

var $quality = ‘100’;

That’s in core.img_lib.php around line 36- then try the different image packages available (GD is not going to be a good choice). See if that gives you results you like. If not- it’s really a limit of the image libraries and handling image manipulation via php. For the dead best results- you want photoshop. So it will be a tradeoff- photoshop for most control, highest quality- then upload that. Or web based- for speed and ease of use.

I’d experiment around, see what looks like the best option given the needs of the particular site.

       
PXLated's avatar
PXLated
1,800 posts
17 years ago
PXLated's avatar PXLated

You might want to check out phpThumb. Just upload your original and let it create the thumbs. You can specify all sorts of various options - size, quality, contrast, etc - but as Robin mentions, if you are really picky, you’ll want to do them yourself in an image editing program.

Edit-Add: There are several threads here in the Forums about using phpThumb.

       
outline4's avatar
outline4
271 posts
about 17 years ago
outline4's avatar outline4
I’ve got a site set up to resize uploaded images to the appropriate size, but the image quality of these resized seems to be very poor! This is the slightly larger original image I uploaded, and this is what EE produced from that. Why is there so much dithering and quality loss? I don’t see any image quality settings anywhere, only the ability to change what image library processes images, and those settings make no difference.

hi, I have about the same quality loss for the pictures on my site. which to my customers eyes and my own is not sufficient… I have GD2 installed.
did you find a solution yet?

cheers stefan

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4

I’m still having issues with the automatic resizing.

  • I am using files extension (this should make no difference, or does it?)
  • I have configured the settings in
  1. File upload prefs (GD 2)
  2. Upload dir (stretch algorithm)

what can I do to improve image quality??

a) will ImageMagick change anything? b) should I use “auto, crop, anchor width, anchor height” in file upload prefs or anything else to get better results?! c) am I missing something obvious?? is there a better way (like the resize plugin/extension/phpthumb)?

Images are really bad (like the example above) and unacceptable for the client… and I don’t want him to resize pictures himself!! there must be a decent way of resizing in acceptable quality, mustn’t there???

thanks - and as always: it’s a bit urgent, cause client want’s to start uploading tons of images…

cheers stefan

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Did you try editing core.image_lib.php var $quality = ‘100’; ? If you still don’t like the results, trying the different image protocols available is a good idea. I tend to use ImageMagic if available, but not so much for quality reasons. EE doesn’t have a lot to do with the image quality- it’s simply using the selected protocol and telling it ‘resize this to these specs’.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
Did you try editing core.image_lib.php var $quality = ‘100’; ? If you still don’t like the results, trying the different image protocols available is a good idea. I tend to use ImageMagic if available, but not so much for quality reasons. EE doesn’t have a lot to do with the image quality- it’s simply using the selected protocol and telling it ‘resize this to these specs’.

I tried editing the core.image_lib.php, but results are still the same! also I tried to put “do not resize” and it keeps going to “auto” and destroying the image quality. something is very wrong here!

I’m going mad! I can’t be the only person having this problem?! customer and I are completely blocked! please help, urgently!

stefan

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Wait- you don’t want to resize the images after all? This is through the standard image upload on the publish page? Once you upload an image- and it shouldn’t alter it at all on upload- you should be able to simply add the image to a field w/out resizing. It simply gives you the option to resize if you want.

Or is this in the gallery?

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
Wait- you don’t want to resize the images after all? This is through the standard image upload on the publish page? Once you upload an image- and it shouldn’t alter it at all on upload- you should be able to simply add the image to a field w/out resizing. It simply gives you the option to resize if you want. Or is this in the gallery?

well, for now I wanted to give the customer the option to upload images without resizing (so for now he uses photoshop). but he leaves soon and the next person is an absolute non-techie…

I’m uploading files through the “file” extension from marc huot.. it’s essential that I can use more than one file… and I don’t want to change the extension! could the extension be the problem? and why is it always jumping to “auto”?

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4

I set it to image magic and used crop, anchor width and strech… and it all renders about the quality of the image attached? are you familiar with the files extension?

       
PXLated's avatar
PXLated
1,800 posts
16 years ago
PXLated's avatar PXLated

Curious as to why using a gif on a photograph rather than jpg? They will usually look worse. Hard to tell your problem though without a side-by-side with what the original is.

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Ah- sorry, I’m not up on the extension. Suspect that was why I was getting a bit confused.

OK- just for now to test the image quality, try disabling the extension- or you can leave it if you can upload normally w/out it. The extension really shouldn’t be messing up the quality unless it’s doing things I don’t expect it is. Most of the quality should result from the image protocol you’re using- and the quality setting in EE. Which is at 100, so not much we can tweak there.

But try a couple of uploads with the normal interface. See how the quality is that way. Should definitely have an unaltered image uploading- and then maybe resize a thumb to same specs you would with ‘file’. Let’s just see what you think.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
Curious as to why using a gif on a photograph rather than jpg? They will usually look worse. Hard to tell your problem though without a side-by-side with what the original is.

hello pxlated! damn! why is it making .gif… I was in such a panic to not even see that! sorry for my behaviour… I’ll think I have to step out of the office for a few minutes and take a deep breath. completely overloaded with work, and it’s my first (real) site with EE. will be back in half an hour… thanks for beeing so patient and for pointing me out in the right direction! it’s image magik that makes .gif’s?! where can you change that behaviour? clueless again…

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Heh- yep, deep breath is always good. Know how frustrating it can be at crunch time. Are they jpgs in the originals? I don’t recall either gd2 or imagemagic converting them automatically. Just double checked on my test install- uploaded a jpg, had it create a thumb (all via standard file upload in publish)- thumb is also a jpg. That’s on EngineHosting using GD2. Didn’t test on one of my IM setups, but I believe the behavior is the same.

I really doubt the file extension would convert the image, but it’s possible. Disable- see if it happens stock. If it does- switch to GD2 and see if it happens. If it does, I might start to suspect something in the server/image settings.

       
outline4's avatar
outline4
271 posts
16 years ago
outline4's avatar outline4
Heh- yep, deep breath is always good. Know how frustrating it can be at crunch time. Are they jpgs in the originals? I don’t recall either gd2 or imagemagic converting them automatically. Just double checked on my test install- uploaded a jpg, had it create a thumb (all via standard file upload in publish)- thumb is also a jpg. That’s on EngineHosting using GD2. Didn’t test on one of my IM setups, but I believe the behavior is the same. I really doubt the file extension would convert the image, but it’s possible. Disable- see if it happens stock. If it does- switch to GD2 and see if it happens. If it does, I might start to suspect something in the server/image settings.

I’ve double checked with the server guys and they say that everything should be installed fine! I will make further tests…

I found image quality related settings at the following locations: CP Home › Admin › Section Administration › File Upload Preferences › Edit File Upload Preferences (tumbnail size) CP Home › Admin › System Preferences › Image Resizing Preferences (GD, GD2, ImageMagik, NetBpm) CP Home › Admin › Section Administration › Global Section Preferences (Enable Image Resizing) and in the core.image_lib.php

class Image_lib {

    var $resize_protocol    = 'gd2';      // Can be:  imagemagick, netpbm, gd, gd2
    var $maintain_ratio        = FALSE;      // Whether to maintain aspect ratio when resizing or use hard values
    var $master_dim            = 'auto';    // height, width, or auto (auto adjusts the dimension based on whether the image is taller then wider or vice versa)
    var $dynamic_output        = FALSE;    // Whether to send to browser or write to disk
    var $thumb_prefix        = '';
    var $file_path            = '';
    var $file_name            = '';
    var $new_file_name        = '';
    var $size_str            = '';
    var $quality            = '100';
    var $dst_width            = '';
    var $dst_height            = '';
    var $rotation            = '';
    var $x_axis                = '';
    var    $y_axis                = '';
    var $wm_x_transp        = 4;
    var $wm_y_transp        = 4;
    
    // Watermark Vars
    
    var $wm_image_path        = '';            // Watermark image
    var $wm_use_font        = TRUE;            // Whether to use the true type font or GD text
    var $wm_font            = 'texb.ttf';    // TT font
    var $wm_font_size        = 17;            // Font size (different versions of GD will eather use points or pixels)
    var $wm_text_size        = 5;            // Native text size if TT font is not used
    var $wm_text            = '';            // Watermark text if graphic is not used
    var $wm_vrt_alignment    = 'T';            // Vertical alignment:   T M B
    var $wm_hor_alignment    = 'L';            // Horizontal alignment: L R C
    var $wm_padding            = 0;            // Padding around text
    var $wm_x_offset        = 0;            // Lets you push text to the right
    var $wm_y_offset        = 0;             // Lets you push  text down
    var $wm_text_color        = '#990000';    // Text color
    var $wm_use_drop_shadow    = FALSE;        // Enables dropshadow
    var $wm_shadow_color    = '#666666';    // Dropshadow color
    var $wm_shadow_distance    = 2;            // Dropshadow distance
    var $wm_opacity            = 50;             // Image opacity: 1 - 100  Only works with image
    var $wm_transp_color    = 'ffffff';    // Color of transparency mask of watermark image
    
    
    // Private Vars
    
    var $mime_type            = '';
    var $thumb_name            = '';
    var $src_width            = '';
    var $src_height            = '';
    var $image_type            = '';
    var $full_src_path        = '';
    var $full_dst_path        = '';
    var $create_fnc            = 'imagecreatetruecolor';
    var $copy_fnc            = 'imagecopyresampled';
    var $libpath                = '';
    var $error_msg            = array();

In fact “file” is using the thumbnail routine from EE. so I have to tweek the thumbnail settings. do you know where these can be found?

I’m a beginner so I might overlook something.

p.s. I guess it’s .gif cause this forum converts it to gif… I found no gifs whatsoever on my system…

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.