system.web.ui.htmlcontrols.htmlInputFile dpi and max length

Hi there,

I'm trying to find a way to get the dpi and maximum length (pixels a the longest end) of an image.

Currently I can use the file control to get the size as demonstrated below, but I can't figure out how to get the other attributes. I'm using VB.Net

filectrImageFile.PostedFile.ContentLength

Thanks!
GeznaAsked:
Who is Participating?
 
itcnbwiseConnect With a Mentor Commented:
I guess you could add these 2 lines to get DPI:

    Dim thisHorizRes As integer = image.HorizontalResolution
    Dim thisVertRes As integer = image.VerticalResolution

(sorry for all the crazy posts - but there's a typo in the earlier one:)
Dim thisWidth As integer = image.width
0
 
seanpowellCommented:
Do you need the dpi to specify how it gets printed?
0
 
itcnbwiseCommented:
'## CHECK DIMENSIONS
Dim image As System.Drawing.Image = Nothing

image = System.Drawing.Image.FromStream(filectrImageFile.PostedFile.InputStream)
      Dim thisHeight As integer = image.height
      Dim thisWidth As integer = image.height

This will get you the width and height of the uploaded image.
0
 
itcnbwiseCommented:
I guess you could add these 2 lines to get DPI:

HorizontalResolution
0
 
GeznaAuthor Commented:
Works like a charm! thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.