Generating Thumbnails (GetThumbnailImage) ...

F

Fabricio Sperandio

Hi everyone,

I am trying to generate some thumbnails using System.Drawing.Image Class.
Actually the GetThumnailImage method. The question is: How can I get a
better thumbnail picture? I mean, when the original size is big, for
example, 800x600 and I generate a small picture (160x120) the quality is
terrible for a jpeg and even orse for a gif. How can I get some better
images? There is another class? There is some resolution propertie I can
set?

Thank you,

Fabrício Sperandio
 
K

Kevin Spencer

Are you really sure you want to generate thumbnails? The reason I ask is
that with HTML, you can set the visible properties of an image, so that it
is resized in the browser. If you use the same image (resized), and need to,
for example, click on the thumbnail to see the larger version of the image,
the larger version will already be cached, and will not have to be
downloaded (again). Not to mention the time you save with processing images
on the fly and HD space.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
F

Fabricio Sperandio

Yeah, I know...

But, what I was looking for is to show the small images faster... The
thumbnails image has 7KB and the original 20KB... And I was expecting to get
a better image than the orignal compressed with html properties...

Thank you dude...
 
E

ESPN Lover

Oddly enough, I'm stuck with the same issue. I want to get better looking
Thumbnail images as well. Mostly the image needs a sharpen filter applied
to it. But I cannot find anywhere that shows "how" to sharpen an image.
I'm willing to do it pixel by pixel, but don't know the algorithm and have
spent all day today searching the internet for info and have been unable to
find an algorithm.
 
E

ESPN Lover

Not to mention, not all browsers support the use of the <IMG attributes to
"resize" the image.
 
S

Scott Mitchell [MVP]

Fabricio said:
I am trying to generate some thumbnails using System.Drawing.Image Class.
Actually the GetThumnailImage method. The question is: How can I get a
better thumbnail picture? I mean, when the original size is big, for
example, 800x600 and I generate a small picture (160x120) the quality is
terrible for a jpeg and even orse for a gif. How can I get some better
images? There is another class? There is some resolution propertie I can
set?

The problem, in a nutshell, is that GIF files are "dithered" and JPEG
images are not saved at a high enough quality. These faults can be
remedied with some rather complicated server-side code. Fortunately,
they have been solved and wrapped up in a nifty class for us to use.
For more information read this article:

Optimizing Color Quantization for ASP.NET Images
http://tinyurl.com/6zl8t

hth

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
E

ESPN Lover

Although this is a great article, this is not what I am experiencing. I'm
seeing the image becoming blurry. No apparent loss of color. No issue with
jpeg compression artifacts. No grainyness. Just plain blurry as if a
"sharpen" filter needs to be applied. This occurs when I resize (shrink)
images using the GetThumbnailImage or when I save images using the
image\jpeg codec with an Encoder.Quality setting in the 80L range using the
image.Save

Any ideas?
 
P

Pat Carden

This happens to me when I fit an image disprportionally to the thumbnail
size. In other words, if you reduce the size of the image and maintain the
aspect ratio then it's not blurry. If you let the image fill the area
automatically, the image is not reduced with the aspect ratio maintained and
the blurriness results. Hope this makes sense.
 
E

ESPN Lover

I have a ratio I resize to keeping the original aspect ratio. if the
original image is 800x600 and I resize it to a 200 pixel wide image, the
resulting height is 150.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top