better thubnails?

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

I have tried using GetThumbnailImage to create thumbnails for uploading on
the internet.
However, quality of such thumbnails is quite poor while file size is quite
large (this is about jpg's).
Is there a way to set a quality and compression level for jpg's, or if not,
does anyone know a good control for it?
 
Create a bitmap of the appropriate size and use DrawImage with the
source/dest
rectangle overloads. This will shrink your image down and then you can save
it out.
GetThumbnailImage does some different things like changing compression
quality and
is probably a bit faster, but you are right about it's image quality.
DrawImage adheres
to some of the Graphics class quality overloads so you can set better or
worse anti-aliasing
to get different speed/quality ratios.

If you have a Bitmap object and can get a pixel data using the basic Get/Set
methods or
by using LockBits (much faster) you can do your own rescaling and sampling
and can
in some cases get better quality for speed ratios than using any of the
provided standard
methods.
 
Hi there,
I have tried using GetThumbnailImage to create thumbnails for uploading on
the internet.
However, quality of such thumbnails is quite poor while file size is quite
large (this is about jpg's).
Is there a way to set a quality and compression level for jpg's, or if not,
does anyone know a good control for it?

I would advise not using GetThumbnailImage at all, as the image quality is
allways crap. I have even had it producing unexpected results at times. My
suspicitions are that it uses a similar method to Shell32.dll's
IExtractImage interface which is capable of retrieving thumbnails from the
little thumbs.db files that plague almost every Windows system.

As just suggest you should create a new bitmap of the desired size and then
use DrawImage from a graphics object created from the bitmap. This way you
can set various properties of the graphics object to set the interpolation
mode, so you can have a blocky effect or a nice smooth effect.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
Hi there,
I have tried using GetThumbnailImage to create thumbnails for uploading on
the internet.
However, quality of such thumbnails is quite poor while file size is quite
large (this is about jpg's).
Is there a way to set a quality and compression level for jpg's, or if not,
does anyone know a good control for it?

I would advise not using GetThumbnailImage at all, as the image quality is
allways crap. I have even had it producing unexpected results at times. My
suspicitions are that it uses a similar method to Shell32.dll's
IExtractImage interface which is capable of retrieving thumbnails from the
little thumbs.db files that plague almost every Windows system.

As just suggest you should create a new bitmap of the desired size and then
use DrawImage from a graphics object created from the bitmap. This way you
can set various properties of the graphics object to set the interpolation
mode, so you can have a blocky effect or a nice smooth effect.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
If there is an embedded thumbnail in your image - which is true for most
images that come from digital cameras - calling GetThumbnailImage() will
return that image. If the size you request is larger, the embedded thumbnail
will be scaled up - with bad results.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Eric,
If there is an embedded thumbnail in your image - which is true for most
images that come from digital cameras - calling GetThumbnailImage() will
return that image. If the size you request is larger, the embedded thumbnail
will be scaled up - with bad results.

Yeah, so I heard. But I have even managed to get the routine to toggle
between the pre-rendered thumbnail and a newly created thumbnail each time
the function is called! Strange huh?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
I got fed up with programming because it's such a
hamster wheel. I'm glad I'm back, but its still a lot
of running just to stay where you are!

:-)
 
Back
Top