Atalasoft Knowledge Base

FAQ: Why does the returned Bitmap have an incorrect resolution?


This can happen in if the driver doesn't supply resolution information in the returned image data. In this case we use the screen resolution, which is normally 96 dpi.

You can manually set the resolution, after acquiring the image, if it doesn't match what you wanted.

Assuming you have

AtalaImage img = AtalaImage.FromBitmap(YourSystemDOTDrawingDOTBitmapOrImage);

you can set any arbitrary resolution by providing a new Dpi to the Resolution property:

img.Resolution = new Dpi(200, 200, ResolutionUnit.DotsPerInch);

This would set it to 200 DPI - please try to avoid non-square resolution values (resolutions where the first and second number differ) as this is an uncommon use case and many viewers/applications will not handle non-sqare resolution images properly - you can use a ResampleCommand to resample an image with non-square resolution into a square resolution - For an example of this please see:

HOWTO: Use TiffFile to Resample FAX images with Unequal Resolutions in a Multi-Page TIFF

Also note: resolution is just metadata. It describes the relation of the pixels in the image to "real world measurement". Changing an image's resolution does NOT resize it up or down image-wise.

For that, you would need to use the ResampleCommand to actually resample the image to another size.

Original Article:

Q10071 - INFO: Why does the returned Bitmap have an incorrect resolution?

Last Modified: 4 Months Ago
Last Modified By: Administrator
Type: FAQ
Article not rated yet.
Article has been viewed 42 times.
Also In This Category