Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting image DPI in relation to height/width C#

Tags:

c#

image

I'm writing an application to send some images to a third party, and the images must be 200x200 DPI. The image is a Bitmap and is sized at 500 width and 250 height.

The first time I tested the images with the third party, my resolution was incorrect. I merely used image.SetResolution(200,200) to correctly set it to 200x200. This, however, only changed the resolution tag for the image and did not properly, according to my third party technical contact, adjust the image height and width.

Is there a ratio that I can use so that for each X units I increment the resolution, I merely increment the corresponding height or width Y units? I thought that I could just increment resolution without having to increment height or width.

Thank you, Aaron.

like image 254
Aaron Avatar asked May 28 '09 14:05

Aaron


People also ask

How do you find the width with height and DPI?

The DPI of a digital image is calculated by dividing the total number of dots wide by the total number of inches wide OR by calculating the total number of dots high by the total number of inches high.

Is 300 DPI high res?

At 300 pixels per inch (which roughly translates to 300 DPI, or dots per inch, on a printing press), an image will appear sharp and crisp. These are considered to be high resolution, or high-res, images.

How do I know if an image is 300 DPI?

To find out an image's DPI in Windows, right-click on the file name and select Properties > Details. You'll see the DPI in the Image section, labeled Horizontal Resolution and Vertical Resolution. On a Mac, you need to open the image in Preview and select Tools > Adjust Size. It's labeled Resolution.

How do you find the resolution with height and width?

To calculate a picture's pixel dimension, multiply the image height and width by its DPI. What is this? For example, a 4×6 photo scanned at 600 DPI would have dimensions of 2400×3600 pixels.


1 Answers

An image stored digitally has no meaningful concept of DPI. DPI comes into play when reproducing an image on a physical device.

You need to adjust the image size with regard to the DPI of the physical device, and the desired size of the output on that device.

For example, if a printer tells you they need an image at 300dpi to fill a space of 4in x 4in then you would provide them a bitmap with a size of 1200x1200 pixels. This image would end up with a physical size of 4in x 4in on a 300dpi output device. On a 600dpi device the same image would have an output size of 2in x 2in.

like image 139
TWA Avatar answered Oct 04 '22 21:10

TWA