GDI+ using setResolution always results in resolution of 96x96
- From: "j" <mr.jawright@xxxxxxxxx>
- Date: 18 Jan 2007 12:56:26 -0800
I am using a Bitmap object to modify JPEG images of variing
resolutions.
We'd decided (albeit arbitrarily) to refactor the images at a
resolution of 200x200, and then rescale the images' dimensions.
The process seems to work, but the images' resoluion is always 96x96,
not 200x200.
I've found no documentation stating any specific, valid resolutions for
a Bitmap object, so it's vexing me that it is not what I specified it
to be.
Relevant Bits of the Code:
System.Collections.Hashtable imageOutputFormatsTable = new
System.Collections.Hashtable();
imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Gif.Guid,System.Drawing.Imaging.ImageFormat.Gif);
imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Jpeg.Guid,System.Drawing.Imaging.ImageFormat.Jpeg);
imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Bmp.Guid,System.Drawing.Imaging.ImageFormat.Bmp);
imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Tiff.Guid,System.Drawing.Imaging.ImageFormat.Tiff);
imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Png.Guid,System.Drawing.Imaging.ImageFormat.Png);
Bitmap outputImage = new Bitmap(origBitmap, newWidth, newHeight);
outputImage.SetResolution(newHRes, newVRes);
ImageFormat outputFormat
=(ImageFormat)imageOutputFormatsTable[origBitmap.RawFormat.Guid];
using (MemoryStream ms = new MemoryStream())
{
outputImage.Save(ms, outputFormat);
outputImage.Dispose();
origBitmap.Dispose();
_image = Image.FromStream(ms, true);
}
.
- Prev by Date: What is ManagedMD.ILMethodException?
- Next by Date: PostBackURL with master page causes Object reference not set error
- Previous by thread: What is ManagedMD.ILMethodException?
- Next by thread: PostBackURL with master page causes Object reference not set error
- Index(es):
Relevant Pages
|