Image originalImage = Image.FromFile(fromPath);
var thumbnailBitmap = new Bitmap((int)newImageWidth, (int)newImageHeight);
var thumbnailGraph = Graphics.FromImage(thumbnailBitmap);
var imageRectangle = new Rectangle(0, 0, (int)newImageWidth, (int)newImageHeight);
thumbnailGraph.DrawImage((Bitmap)originalImage, imageRectangle);
I am sorry but I don't see how that is saving the image as an Image object.
I am using GD+ to create a thumbnail so I use something like what I pasted above. The problem is that I want to do some more stuff using the Image object.
Member
2 Points
33 Posts
Converting from Graphics or Bitmap back to Image
Jul 06, 2010 01:08 PM|atholonxp|LINK
Is there a way to set an Bitmap object back to an Image object in .net?
Member
300 Points
86 Posts
Re: Converting from Graphics or Bitmap back to Image
Jul 06, 2010 02:32 PM|rajum|LINK
Bitmap
Member
2 Points
33 Posts
Re: Converting from Graphics or Bitmap back to Image
Jul 06, 2010 02:50 PM|atholonxp|LINK
I am sorry but I don't see how that is saving the image as an Image object.
I am using GD+ to create a thumbnail so I use something like what I pasted above. The problem is that I want to do some more stuff using the Image object.
Can I just cast the bitmap to the Image type?
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">var thumbnailBitmap = new Bitmap((int)newImageWidth, (int)newImageHeight);</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> var thumbnailGraph = Graphics.FromImage(thumbnailBitmap);</div>Member
2 Points
33 Posts
Re: Converting from Graphics or Bitmap back to Image
Jul 06, 2010 03:14 PM|atholonxp|LINK
Doh, it looks like you don't even need to cast.
I just did Image originalImage = thumbnailBitmap;
Member
300 Points
86 Posts
Re: Converting from Graphics or Bitmap back to Image
Jul 06, 2010 03:20 PM|rajum|LINK