Jump to content

Recommended Posts

Hi all,

 

Does anyone else have this issue? When using the automatic resizing (thumbnail generation) function from admin, the image quality of the resultant thumbnails is very poor.

 

Our source files are very clean, high res and high quality, and we've tried bumping the jpeg compression up to 100% in the admin panel.

 

We've tried uncompressed png > jpg and high quality jpg > jpg. But the image quality coming out of the automatic resizing code seriously degrades the images. PLus we have a plain cream BG colour which gets artifacts all over it. What's going on??

 

Is it perhaps possible to replace the PHP library that's doing the image processing with a better one? If we can't resolve this we'll be forced to manually save out the images at all sizes (which is easy using photoshop's batch function) and replace the ones prestashop creates (which looks to be a major headache as it seems to put them in different directories...)

 

 

Any pointers would be great.

 

Cheers!

Link to comment
Share on other sites

  • 2 weeks later...

Hi Phrasespot,

 

Please see attached images. The source-file.jpg is, predictably, the source. I am of the opinion that the distortion appears as a result of the scaling operation, as the Thickbox variant appears not to have the background color distortion pattern (it was re-saved but not re-sized). These were saved with JPG quality setting of 100.

 

Cheers,

 

Rory

 

presta images.zip

Link to comment
Share on other sites

Sorry - the file referred to above as "thickbox" is actually called "kd1021-Lavender-A". It was resaved but not resized. The issue is worse with the smaller images.

 

Any feedback would be appreciated.

 

Thanks

Rory

Link to comment
Share on other sites

I am of the opinion that the distortion appears as a result of the scaling operation

True, and I am not sure if this is a solvable problem on PrestaShop's part. Using a pretty expensive Photoshop plugin, I can barely manage better results scaling a 995x1200 image to e.g. 123x148. Also bear in mind that we have to work with jpgs as source.

post-103572-0-58045300-1339503266_thumb.jpg

post-103572-0-91890400-1339503274_thumb.jpg

Edited by phrasespot (see edit history)
Link to comment
Share on other sites

Hi Phrasespot,

 

Thanks for doing the test. It's a bit hard to see at that size, but they do seem similar.

 

My main issue is with the larger images used on product page etc, as the design calls for these to merge seamlessly into a page BG of the same cream colour as the jpeg. So any artifacts become even more obvious. As you can see the problem is with subtle (but pervading) pattern noise in the BG. This is not evident when I scale down from 1200 and save larger images (say 385x440) out of photoshop (I'll post a test image later).

 

Regarding solutions/workarounds - 3 options perhaps:

 

1 - is it possible to replace the PHP image processing script in prestashop?

 

2 - Or is there an easy way to replace all the different sized prestashop-generated images with photoshop-saved ones? This would have the added advantage that you could use uncompressed source files (PSD) and add a sharpening filter as an action. The issue would be how to easily find and replace the files prestashop makes - they seem to be filed in different folders and locations in a slightly idiosyncratic way.

 

3 - failing that, is there a way to force prestashop to use different images? That way we could save all of a products images to 1 folder and relink them.

 

Any thoughts on these options?

 

Many thanks!

 

Rory

Link to comment
Share on other sites

1 - is it possible to replace the PHP image processing script in prestashop?

This is already answered by Carl I think

 

2 - they seem to be filed in different folders and locations in a slightly idiosyncratic way.

Depending on whether you use the old image system or the new image system, they are either kept in

 

/img/p/productid-imageid.ext

 

or

 

/img/p/i/m/a/g/e/i/d/imageid.ext

 

where image id is assigned everytime you add an image to a product. I am afraid there is a bug though and you will find images outside this convention in /img/ directory.

 

3 - failing that, is there a way to force prestashop to use different images? That way we could save all of a products images to 1 folder and relink them.

This is what old image system did but it may become unwieldy when there are a lot of products with a lot of images.

 

Hopefully a later version of PS will introduce a media library à la WordPress and solve the type of issues you are facing.

Link to comment
Share on other sites

  • 8 months later...
  • 1 year later...
  • 3 weeks later...

Hi,

 

Prestashop 1.5.6.2.

Same problem.

All my images are very bad quality, wether I use jpeg 10, jpeg 100, or png 0, I can't even see a difference in quality. My logo is in everycase equally blurred and distorted.

I can't believe that there's no way to resize an image cleanly (prestashop can do it, so it is possible).

 

Anybody has found a solution or a workaround yet?

 

I'm just thinking it could be interesting to look at the filigrane module.

So far, I've looked in ImageManager.php and saw nothing suspicuous, except this: imagecopyresampled seems to be a bilinear function. Better quality could be expected from a bicubic function? What do you think?

 

Thanks.

 

edit: fixed: the URL on my test site was still pointing to the prod site, so images didn't change because they were fetched from the prod site! Definitely silly :(

I raised the quality to PNG 4, images are some 65% bigger, it's still not good, but too big is not good either.

Obviously, some algorithms are not optimized, because Photoshop "save for the web" gives me much much better quality in a file size 2/3 smaller! If someone finds the good algorithm, he can make a very interesting module! Maybe it even exists ...

Edited by PBo34 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hello everybody  :)

 

I had the same issue. Images were resized with noisy and a bit gray background, even if the source image had a white background and even if my image preferences were set to the best quality. I have found a solution, it works well for me.

 

SOLUTION!!! - I only tested it on my test PS 1.6.0.14 site

1. Go to folder "classes" and open file "ImageManager.php"

2. Go to line 245:

imagecopyresampled($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), (int)(($dst_height - $next_height) / 2), 0, 0, $next_width, $next_height, $src_width, $src_height);

3. Change "imagecopyresampled" php function with "imagecopyresized":

imagecopyresized($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), (int)(($dst_height - $next_height) / 2), 0, 0, $next_width, $next_height, $src_width, $src_height);

Hope this solves your problems.

 

Regards,

Housy

Link to comment
Share on other sites

Well i have checked some images and this is not the best option to do to be honest. If you replace php image function, you will get images without noisy gray background but it is worse image quality, so i'm asking you guys, if there is any other way to stay with current "imagecopyresampled" php function, except image would have white background as it is in the source image?

 

Thank you and best regards,

Housy

 

Hello everybody  :)

 

I had the same issue. Images were resized with noisy and a bit gray background, even if the source image had a white background and even if my image preferences were set to the best quality. I have found a solution, it works well for me.

 

SOLUTION!!! - I only tested it on my test PS 1.6.0.14 site

1. Go to folder "classes" and open file "ImageManager.php"

2. Go to line 245:

imagecopyresampled($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), (int)(($dst_height - $next_height) / 2), 0, 0, $next_width, $next_height, $src_width, $src_height);

3. Change "imagecopyresampled" php function with "imagecopyresized":

imagecopyresized($dest_image, $src_image, (int)(($dst_width - $next_width) / 2), (int)(($dst_height - $next_height) / 2), 0, 0, $next_width, $next_height, $src_width, $src_height);

Hope this solves your problems.

 

Regards,

Housy

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

In Classes > ImageManager.php

find 

public static function imagecopyresampled(&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3)

and replace

$quality = 3 with $quality = 5    (or 4)   you have to test it

 

you can try in BO > preferences > images  set "Generate high resolution images" to YES

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

I also was confused with this issue. What I did is that I set the image size for home_default, large_default and thickbox_default exactly the same as the original images I imported adding the products (1200x1200 px in my case). So PrestaShop did not resize them and the result is just perfect. It is important, however, not to set the size bigger than the original image, since then it will appear smaller size in the front office.

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
×
×
  • Create New...