Re: Find the resolution of images
- From: "Subbu" <venkata45@xxxxxxxxx>
- Date: 13 Dec 2006 22:46:26 -0800
Hi Bob
i need to find the resolution of uploaded images whether the
resolution of images is less than 300 DPI or not. is this correct way
to find the resoultion of images
Dim MyImage As System.Drawing.Image = Nothing
MyImage = System.Drawing.Image.FromFile(ImageFile)
Dim sf As SizeF = New SizeF(CSng(MyImage.Width) /
MyImage.HorizontalResolution, CSng(MyImage.Height) /
MyImage.VerticalResolution)
Dim targetpic As Integer = Nothing
Dim myimgpic As Integer = Nothing
'Target Pixels of the image to have 300 DPI
targetpic = Convert.ToInt64((sf.Width * 300) * (sf.Height *
300).ToString())
'Actual Pixels of the image
myimgpic = Convert.ToInt64((MyImage.Width *
MyImage.Height).ToString())
If targetpic = myimgpic Then
Response.write("Image is 300 DPI")
Else
Response.write("Image is not 300 DPI")
End If
i need your help Bob
Thank You
Subbu
Bob Powell [MVP] wrote:
It seems that you have a misunderstanding of what resolution actually is.
What do you really want to do?
--
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.
"Subbu" <venkata45@xxxxxxxxx> wrote in message
news:1165568293.865166.303680@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
To check the resolution of images is 300 DPI or not I using this code.
Is this correct way to find the resolution of images?
Dim MyImage As System.Drawing.Image = Nothing
MyImage = System.Drawing.Image.FromFile(ImageFile)
Dim sf As SizeF = New SizeF(CSng(MyImage.Width) /
MyImage.HorizontalResolution, CSng(MyImage.Height) /
MyImage.VerticalResolution)
Dim targetpic As Integer = Nothing
Dim myimgpic As Integer = Nothing
'Target Pixels of the image to have 300 DPI
targetpic = Convert.ToInt64((sf.Width * 300) * (sf.Height *
300).ToString())
'Actual Pixels of the image
myimgpic = Convert.ToInt64((MyImage.Width * MyImage.Height).ToString())
If targetpic = myimgpic Then
Response.write("Image is 300 DPI")
Else
Response.write("Image is not 300 DPI")
End If
Can you please give me your suggestions on finding the resolution of
images 300DPI?
Thanks in advance
Thank You
Subbu
.
- Follow-Ups:
- Re: Find the resolution of images
- From: Bob Powell [MVP]
- Re: Find the resolution of images
- References:
- Find the resolution of images
- From: Subbu
- Re: Find the resolution of images
- From: Bob Powell [MVP]
- Find the resolution of images
- Prev by Date: Re: sRGB - scRGB
- Next by Date: When to use CreateGraphics, FromHdc and FromHwnd
- Previous by thread: Re: Find the resolution of images
- Next by thread: Re: Find the resolution of images
- Index(es):
Relevant Pages
|