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 100x100, and then rescale the images dimensions.
The process seems to work, but the images' resoluion is always 96x96,
not 100x100.
I've found no documentation stating any specific, valid resolutions for
a Bitmap object, so it's vexing me that it it 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,Sys*tem.Drawing.Imaging.Imag eFormat.Gif);
imageOutputFormatsTable.Add(System.Drawing.Imaging .ImageFormat.Jpeg.Guid,Sy*stem.Drawing.Imaging.Ima geFormat.Jpeg);
imageOutputFormatsTable.Add(System.Drawing.Imaging .ImageFormat.Bmp.Guid,Sys*tem.Drawing.Imaging.Imag eFormat.Bmp);
imageOutputFormatsTable.Add(System.Drawing.Imaging .ImageFormat.Tiff.Guid,Sy*stem.Drawing.Imaging.Ima geFormat.Tiff);
imageOutputFormatsTable.Add(System.Drawing.Imaging .ImageFormat.Png.Guid,Sys*tem.Drawing.Imaging.Imag eFormat.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);
}