473,324 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

GDI+ SetResolution always results in 96x96

j
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);
}

Jan 18 '07 #1
0 2614

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DrDevious | last post by:
Maybe I am doing something wrong but has anyone else here noticed a difference in the positioning of text between the Graphics.DrawString method and the Win32 GDI DrawText function? My text is...
1
by: ivang | last post by:
Hi. How to create and save JPEG bitmap with 300dpi? Thanks.
5
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
1
by: James dean | last post by:
Could someone explain how this works. I think the graphics card is used to do blitting and drawing shapes like rectangles. How does it draw using the Graphics card on the PC and why is this feature...
0
by: Steve McLellan | last post by:
Hi, I need to convert a System.Drawing.Bitmap into a GDI bitmap, store the GDI bitmap, and then later display it using BitBlt. The storing part is giving me a little trouble. Given a paint...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: j | last post by:
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'...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.