Re: image graphics drawing confusion
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 07/30/04
- Next message: Tim Dawson: "Re: backgroundimage on custom control"
- Previous message: stew_mclean: "backgroundimage on custom control"
- In reply to: cwineman: "Re: image graphics drawing confusion"
- Next in thread: cwineman: "Re: image graphics drawing confusion"
- Reply: cwineman: "Re: image graphics drawing confusion"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 30 Jul 2004 17:39:59 +0200
The GDI+ FAQ has articles on changing the resolution of an image and drawing
an image that will explain the process in more detail. Here's how to reduce
an image to 50% it's size...
Bitmap bm=Bitmap.FromFile("myImage.bmp");
Bitmap tmp=new Bitmap(bm.Width/2, bm.Height/2);
Graphics g=Graphics.FromImage(tmp);
g.DrawImage(bm,new
Rectangle(0,0,tmp.Width,tmp.Height),0,0,bm.Width,bm.Height,GraphicsUnit.Pixe
l);
g.Dispose();
bm.Dispose();
tmp.Save(......); // save the half-size file
Some JPEG images have a pre-defined thumbnail. This would have been
generated before you modified the image. I'm assuming that you changed the
bits for the main image, saved the thing, including the old thumbnail and
when you extract the thumbnail the software decides to use the old,
unchanged bits of the supplementary image, not the new ones.
-- Bob Powell [MVP] Visual C#, System.Drawing The Image Transition Library wraps up and LED style instrumentation is available in the June of Well Formed for C# or VB programmers http://www.bobpowell.net/currentissue.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/gdiplus_faq.htm The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml "cwineman" <me@home.com> wrote in message news:410a4ec8$1_2@127.0.0.1... > I don't understand. I take an image, and write some ellipses on it. Fine. > Take that image and save it to disk and there it is with the ellipses drawn > on it. Good. Now, take the same image and create a thumbnail version of it. > Save it. Its a thumbnail, but there are no ellipses. Where did they go? > > If there are two different buffers how do I know which ones are going to get > used in different method calls? The Save() method uses a buffer that has my > modifications, but the GetThumbnailImage() doesn't? How does that make > sense? > > How do I "create your own thumbnail by drawing the image to a correctly > sized memory bitmap"? What methods do I use? Do you have a link to an > example maybe? > > Thanks, > -cwineman > > > "Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message > news:uIoJgDcdEHA.4092@TK2MSFTNGP10.phx.gbl... > > I think this problem comes from the fact that your AdjustImageSize routine > > gets a thumbnail image. This isn't drawn from the bits you've modified but > > from the thumbnail that already exists in the jpeg file. > > > > Rather than use the GetThumbnailImage method, create your own thumbnail by > > drawing the image to a correctly sized memory bitmap. > > > > -- > > Bob Powell [MVP] > > Visual C#, System.Drawing > > > > The Image Transition Library wraps up and LED style instrumentation is > > available in the June of Well Formed for C# or VB programmers > > http://www.bobpowell.net/currentissue.htm > > > > Answer those GDI+ questions with the GDI+ FAQ > > http://www.bobpowell.net/gdiplus_faq.htm > > > > The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml > > Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml > > Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml > >
- Next message: Tim Dawson: "Re: backgroundimage on custom control"
- Previous message: stew_mclean: "backgroundimage on custom control"
- In reply to: cwineman: "Re: image graphics drawing confusion"
- Next in thread: cwineman: "Re: image graphics drawing confusion"
- Reply: cwineman: "Re: image graphics drawing confusion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|