Jump to content

Image resize gives bigger file but less quality


reems
 Share

Recommended Posts

Hi,

I have strange behavior with the standard imagefield resize.

I use in a template the following:

$options = array(
                'quality' => 100,
                'upscaling' => false       
                ); 
            
$img = $image->width(900,$options);

My client has some images uploaded that are 1920 pixels width and one is 374 kB.
 

After downsizing to a width of 900 the quality is much worse then experienced with other uploaded images while the original was oke. But the most strange is that the downsized image is now 522kB instead of 374 kB.

Another goes from 211kb to 291kB.

While afcourse we expected a much lesser filesize.

Any ideas how this can happen and what to do about it?

Maybe putting in some extra options?

Thanks.

Link to comment
Share on other sites

(If you used JPGs) You've set the quality to 100. While the reduced image with might make the image smaller, the higher quality level will render it at a larger size. This can result in larger file size..the problem you've probly encountered. This also happened to PNGs with PW 2.4 but I think it got fixed with 2.5... ?

You could try to use a lower quality setting (IMO 100 is never useful) or use e.g. the ProcessImageMinimize module linked in my signature :)

  • Like 2
Link to comment
Share on other sites

This has caught me out previously. The assumption in my head is that by setting it a hundred you are setting it to be the maximum it was originally, but of course, it doesn't work that way, it just produces a high quality version of what your image was.

It doesn't look nicer, but all the original faults are being rendered wonderfully!

  • Like 2
Link to comment
Share on other sites

@reems: in this case, you and your client have done it completely thewrong way around :)

Your client has uploaded already compressed JPEGs (maybe with a quality of 80%) and you have rendered them uncompressed with quality 100. Your client should upload images with max quality and those originals never should passed as frontend output. They only should serve as source for variations! This way round you get nicer looking images, and if you need more compression than the GD-lib can serve, use Philipps service. :)

.

If you need, for what ever reason the exact original sized image output on frontend, you can call it like:

$image = $page->images->first();
echo "<img src='{$image->width($image->width)->url}' />";
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...