Answered by:
bitmap size image ?

Question
-
User632428103 posted
Hello,
I would like to know what does it mean this code :
new Image(300, 300);
Ok it will generate an image with the size in 300 px but the result will be an image of what SIZE exactly ?
In centimeter for example
How i can know the size exactly ?
thanks
Friday, February 7, 2020 12:38 PM
Answers
-
User753101303 posted
Hi,
Seems you want to look at the HorizontalResolution, VerticalResolution properties to get the number of pixels for an inch. Use https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.setresolution?view=netframework-4.8 if you want to change those values.
You may want to be more explicit. AFAIK this is basically just an hint that is useful or not depending on the situation. If scroling down at https://www.mydevice.io/ you'll see that some devices are lying on the "CSS pixel" (even some with fractional values) to avoid showing very small images on a high resolution display.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, February 7, 2020 1:18 PM -
User288213138 posted
Hi jimmy69,
new Image(300, 300);
Ok it will generate an image with the size in 300 px but the result will be an image of what SIZE exactly ?
Is the Image in your code an Image class? As far as i know, if you want to set the image size, you should try the Bitmap class.
If you wan to convert Pixels to centimeter, you can try below formula.
centimeters = pixels * 2.54 / 96
More information about convert Pixels to centimeter you can refer to this link: https://stackoverflow.com/questions/1341930/pixel-to-centimeter/23438228#23438228
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 10, 2020 6:35 AM
All replies
-
User753101303 posted
Hi,
Seems you want to look at the HorizontalResolution, VerticalResolution properties to get the number of pixels for an inch. Use https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.setresolution?view=netframework-4.8 if you want to change those values.
You may want to be more explicit. AFAIK this is basically just an hint that is useful or not depending on the situation. If scroling down at https://www.mydevice.io/ you'll see that some devices are lying on the "CSS pixel" (even some with fractional values) to avoid showing very small images on a high resolution display.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, February 7, 2020 1:18 PM -
User288213138 posted
Hi jimmy69,
new Image(300, 300);
Ok it will generate an image with the size in 300 px but the result will be an image of what SIZE exactly ?
Is the Image in your code an Image class? As far as i know, if you want to set the image size, you should try the Bitmap class.
If you wan to convert Pixels to centimeter, you can try below formula.
centimeters = pixels * 2.54 / 96
More information about convert Pixels to centimeter you can refer to this link: https://stackoverflow.com/questions/1341930/pixel-to-centimeter/23438228#23438228
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 10, 2020 6:35 AM -
User632428103 posted
Hello all,
thanks for our comment that's exactly what i want
Tuesday, February 11, 2020 9:57 AM