Re: Find the resolution of images



No, I sent you ther way to find the correct resolution. it's a couple of
lines.

--
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:1166078786.470669.172340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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




.



Relevant Pages

  • Re: rasterization parameters
    ... The 96 DPI is indeed coming from the system. ... save images with a specific resolution. ... Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • image sizing problem
    ... it seems that IE 6.0 cannot display correctly ... in 120 dpi resolution. ... I have a 1400x1050 resolution ... >the images a bit larger then their size, ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Setting resolution of exported images from VB
    ... in pixels but not the dot-per-inch resolution. ... Application you can specify the resolution by a register but it doesn't ... There's no specific property for DPI because it's rather meaningless. ... I checked the produced images with Adobe Photoshop and I ...
    (microsoft.public.powerpoint)
  • Re: Poor image quality in Microsoft word
    ... but when printing it to a pdf file the resolution is ... Word "should" respect the dpi of the imported image. ... The less chance you give Word to have its wicked way with your images, ...
    (microsoft.public.mac.office.word)
  • Re: Find the resolution of images
    ... It seems that you have a misunderstanding of what resolution actually is. ... Is this correct way to find the resolution of images? ... Dim MyImage As System.Drawing.Image = Nothing ... 'Target Pixels of the image to have 300 DPI ...
    (microsoft.public.dotnet.framework.drawing)