locked
Resize image if it is greater than a specified resolution. RRS feed

  • Question

  • User1680738075 posted

    How Can I check the resolution of a picture?

    If the resolution is greater than 120x80 then put the resolution on 120x80.
    I am very grateful for source code or tips.

     

    Golf-Driver

    Monday, December 15, 2008 8:13 AM

Answers

  • User-653327211 posted

    I hope this code works out for you:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim img As New System.Drawing.Bitmap(Server.MapPath("filename.gif"))

    If img.Width > 120 And img.Height > 80 Then

    'use this function to resize your image

    http://www.glennjones.net/Post/799/Highqualitydynamicallyresizedimageswithnet.htm

    End If

    End Sub

    Good Luck!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 15, 2008 9:19 AM

All replies

  • User-653327211 posted

    I hope this code works out for you:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim img As New System.Drawing.Bitmap(Server.MapPath("filename.gif"))

    If img.Width > 120 And img.Height > 80 Then

    'use this function to resize your image

    http://www.glennjones.net/Post/799/Highqualitydynamicallyresizedimageswithnet.htm

    End If

    End Sub

    Good Luck!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 15, 2008 9:19 AM
  • User1680738075 posted

    Thank you.

    That is very helpful to me :)

    Monday, December 15, 2008 11:08 AM