Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

GDI+ encoder CLSIDs, and image resampling

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TC - 18 Feb 2005 02:49 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.