Picture Thumbnail quality


https://forum.kartris.com/Topic3813.aspx
Print Topic | Close Window

By Jmaie - Tue 30 Jun 2015
Hiya,

From going through the forms it has become clear to me that the store generates a thumbnail as and when it's needed which is cool I guess but how can I increase the quality of said thumbnails? To be honest the other thumbnails look good enough but there's just one that is irking me and my colleagues to the extent that I'm making this post.

Any help would be appreciated.

Thanks Smile
By metalmania - Tue 30 Jun 2015
If you are not just referring to the images sizes, which are controlled by config settings...
e.g.frontend.display.images.thumb.height 160
frontend.display.images.thumb.width 160

then firstly I would consider trying to provide a higher quality original in PNG format, failing that you probably need to look at the image.aspx file in the root directory.

The System.Drawing.Imaging.Encoder.Quality parameter is the one that controls the quality of the resized image - this is set to 90L, you could try changing it to the max which is 100L.

https://msdn.microsoft.com/en-us/library/system.drawing.imaging.encoder.quality(v=vs.110).aspx
By Jmaie - Tue 30 Jun 2015
I wasn't referring to the image size, no. I tried setting the System.Drawing.Imaging.Encoder.Quality parameter to 100L and 10L to see if it was making any difference in the thumbnail generation. It didn't.

I'm very new to Kartris and most things that surround it. Could you pin down exactly where this setting is (in case I'm changing the wrong one)?

Thanks for your fast reply Smile



Jmaie
By metalmania - Tue 30 Jun 2015
Line 118Params.Param(0) = New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 90L)

Increasing this will obviously have the knock on effect of producing slightly larger physical file sizes.

Line 133 sets the InterpolationMode
grphCanvas.InterpolationMode = InterpolationMode.HighQualityBicubic

"HighQualityBicubic" - Specifies high-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking. This mode produces the highest quality transformed images....so that setting seems to be optimum.

Did you try (if possible) providing a higher quality original image? Providing an image with a higher DPI initially would probably be of benefit when it's re-sized to thumbnail size.
By Jmaie - Tue 30 Jun 2015
We went through and tested images that had a higher res and the spot on res of 160x160 and the results were better with an image of higher res (as you would expect).

However the image is still looking a little bit rough but now in a different way. Before the image, a red logo on a white background, would have noise around it which made it look shabby. Now the image suffers from noise inside the logo.

The red is meant to be the same shade for the whole thing but instead it look's like this http://puu.sh/iIk69/7e8b7d4859.jpg in stead of this http://puu.sh/iIkw9/3e7f98c291.jpg (I zoomed in to make the issue clearer and for the sake of comparison)


We are considering just living with it at the moment because of how much time this has wasted.


Thanks again for your help.
By metalmania - Tue 30 Jun 2015
Yeah, I see what you mean...it looks like jpeg artifacts problem you have with that image, which doesn't lend itself to JPG format.
You may have noticed that image.aspx always output a jpg file, regardless of what you provided. You can see the code commented out starting at around line 168.
In this example, you could try providing a .gif original image, then uncomment the code to allow for outputting a .gif OR .jpg
e.g.
Select Case FInfo.Extension.ToUpper
'leave the png commented out
' Case ".PNG"
' bmpImage.Save(Response.OutputStream, ImageFormat.Png)
Case ".GIF"
bmpImage.Save(Response.OutputStream, ImageFormat.Gif)
Case Else
bmpImage.Save(Response.OutputStream, ImageFormat.Jpeg)
End Select
'comment out this next line
'bmpImage.Save(Response.OutputStream, ImageFormat.Jpeg)

[Edit] After a bit more research, I don't think the above is going to help - GIF's don't seem to be handled too well. The only other thing I can suggest is using a PNG and changing the above to save a source PNG back as a PNG, however from what I've read you have to be careful to use 24bppRGB format PNG files, not indexed pixel format, otherwise it would fail...
https://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
By Jmaie - Tue 30 Jun 2015
I'll give that a try tomorrow and I'll let you know how it goes.

Thanks
By Supermac - Tue 30 Jun 2015
here https://msdn.microsoft.com/it-it/library/bb882583%28v=vs.110%29.aspx they use a different syntax to define compression of jpeg (& instead of L), may this be the cause?