Hi folks
Sorry if this is OT, but I got no joy in
microsoft.public.win32.programmer/gdi.
(1) I'm encoding to standard (built-in) formats: JPEG, BMP, GIF etc. I
currently have the encoder CLSIDs hardcoded. Is that safe, or should I
iterate the encoders at runtime, looking for ones with the relevant
MIME types?
(2) I'm using GdipGetImageThumbnail() to resample images smaller *or
larger*. I've tried altering the interpolation mode to see if that
makes any difference. It doesn't seem to. Here's what I'm doing:
GdipGetImageGraphicsContext lOldBitmap, graphics
GdipSetInterpolationMode graphics, <mode>
GdipGetImageThumbnail lOldBitmap, W, H, lNewBitmap
- Is GdipGetImageThumbnail() appropriate for resampling images larger,
or is there a better way?
- Should it use the interpolation mode that I have tried to set above?
- Why does changing the interpolation mode, require a graphics context?
Resampling is just a mathematical operation on the bitmap content. What
does the graphics context contribute?
TIA,
TC
Bob Powell [MVP] - 18 Feb 2005 11:24 GMT
If you know the encoder CLSID there is no reason not to hard-code it. I
guess GDI+ was intended to evolve but has been kind-of shelved in favour of
Avalon. Bit of a shame really but that's life...
I reccommend not using the GetThumbnailImage method. It usually gives crude
results. It's better to do the job by drawing the whole image to a newly
created image of a different size. This works for reductions as well as
enlargements. The GDI+ FAQ has an example.
Bitmap is simply a storage medium. It does no manipulations of Graphics
beyond the getpixel / setpixel / rotateflip level. It's the Graphics object
that does interpolation etc so that's why you need one.
I have found that the bilinear interpolation is often nicer quality than the
bicubic. Perhaps this is just my sense of esthetics at work.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Hi folks
>
[quoted text clipped - 25 lines]
> TIA,
> TC
TC - 19 Feb 2005 01:05 GMT
Thanks Bob, that's exactly what I wanted to know.
TC