![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
One reads an image from a file that has, maybe, a resolution of 300 PPI. And another image that is 600ppi. And Draw them it onto a PictureBox.Image that has a 96ppi resolution. How does one go about maintaining the correct size (inches) (I don't know the correct term to describe this kind of size.) I mean, suppose the two images are 5x7 inches at different resolutions. How to go about it so that the result on the PictureBox is two images that are the same size, each aprox 5x7. |
#3
| |||
| |||
|
|
Hello , One reads an image from a file that has, maybe, a resolution of 300 PPI. And another image that is 600ppi. And Draw them it onto a PictureBox.Image that has a 96ppi resolution. How does one go about maintaining the correct size (inches) (I don't know the correct term to describe this kind of size.) I mean, suppose the two images are 5x7 inches at different resolutions. How to go about it so that the result on the PictureBox is two images that are the same size, each aprox 5x7. Sounds like you'll just have to calculate :-) If your image is 5 inches wide and has a resolution of 300dpi, then it is 1500 pixels wide. If the screen has a resolution of 96dpi, then it uses up 5*96=480 pixels for a 5 inch wide surface. So you have to scale your image down from 1500 pixels to 480 pixels width and you'll be fine. Calculate the height the same way, and the two values for the other image with the 600pdi resolution as well, and you should have the result you want. Oliver Sturm |
#4
| |||
| |||
|
|
Why do you imagine you have to draw them?? Put them in the Image property! |
#5
| |||
| |||
|
|
Thanks, I can do the calculations but wondered if images had imbedded in them info about their size |
|
that would essentially cause the conversion to the display. |
|
So if I have a file containing an image intended for a printer I really can't display it without some pixel merging or it will display much bigger then it will print. |
#6
| |||
| |||
|
|
Why do you imagine you have to draw them?? Put them in the Image property! -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. Oliver Sturm wrote: Hello , One reads an image from a file that has, maybe, a resolution of 300 PPI. And another image that is 600ppi. And Draw them it onto a PictureBox.Image that has a 96ppi resolution. How does one go about maintaining the correct size (inches) (I don't know the correct term to describe this kind of size.) I mean, suppose the two images are 5x7 inches at different resolutions. How to go about it so that the result on the PictureBox is two images that are the same size, each aprox 5x7. Sounds like you'll just have to calculate :-) If your image is 5 inches wide and has a resolution of 300dpi, then it is 1500 pixels wide. If the screen has a resolution of 96dpi, then it uses up 5*96=480 pixels for a 5 inch wide surface. So you have to scale your image down from 1500 pixels to 480 pixels width and you'll be fine. Calculate the height the same way, and the two values for the other image with the 600pdi resolution as well, and you should have the result you want. Oliver Sturm |
#7
| |||
| |||
|
|
Hello , One reads an image from a file that has, maybe, a resolution of 300 PPI. And another image that is 600ppi. And Draw them it onto a PictureBox.Image that has a 96ppi resolution. How does one go about maintaining the correct size (inches) (I don't know the correct term to describe this kind of size.) I mean, suppose the two images are 5x7 inches at different resolutions. How to go about it so that the result on the PictureBox is two images that are the same size, each aprox 5x7. Sounds like you'll just have to calculate :-) If your image is 5 inches wide and has a resolution of 300dpi, then it is 1500 pixels wide. If the screen has a resolution of 96dpi, then it uses up 5*96=480 pixels for a 5 inch wide surface. So you have to scale your image down from 1500 pixels to 480 pixels width and you'll be fine. Calculate the height the same way, and the two values for the other image with the 600pdi resolution as well, and you should have the result you want. Oliver Sturm -- http://www.sturmnet.org/blog |
#8
| |||
| |||
|
|
Hello, Thanks, I can do the calculations but wondered if images had imbedded in them info about their size I believe that is in fact the case with many common graphics formats, but I don't know anything about the details. This would also vary with the format you use. that would essentially cause the conversion to the display. It wouldn't "cause" it - I don't think there's a standard control available that would automatically read that info and do the scaling and displaying for you. But of course that information could be used for your purpose - I was actually assuming when I read your original question that you already had that info, probably from the source we were just discussing. So if I have a file containing an image intended for a printer I really can't display it without some pixel merging or it will display much bigger then it will print. Right. Of course. If the image contains far more pixel information than you can display on your screen, there's really nothing you can do about it, other dropping or merging some of it. Oliver Sturm |
#9
| |||
| |||
|
|
If you use DrawImage without the full specification of source ad destination rectangle the software takes the resolution into account automatically. |
#10
| |||
| |||
|
|
Hello, Thanks, I can do the calculations but wondered if images had imbedded in them info about their size I believe that is in fact the case with many common graphics formats, but I don't know anything about the details. This would also vary with the format you use. that would essentially cause the conversion to the display. It wouldn't "cause" it - I don't think there's a standard control available that would automatically read that info and do the scaling and displaying for you. But of course that information could be used for your purpose - I was actually assuming when I read your original question that you already had that info, probably from the source we were just discussing. So if I have a file containing an image intended for a printer I really can't display it without some pixel merging or it will display much bigger then it will print. Right. Of course. If the image contains far more pixel information than you can display on your screen, there's really nothing you can do about it, other dropping or merging some of it. Oliver Sturm -- http://www.sturmnet.org/blog |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |