Results 1 to 5 of 5

Thread: [RESOLVED] Get Dimensions of Image

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    9

    Resolved [RESOLVED] Get Dimensions of Image

    Im using LoadPicture to load in gif and jpg images and i was wondering how you would get the dimensions (height and width) of the image. Is there an API for this? Thanks in advance

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Get Dimensions of Image

    You could load it into a picturebox with the autosize property to true, and then get the width/height properties of the picbox...


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    9

    Re: Get Dimensions of Image

    Well im not going to be using the images in an activex control so i wanted to avoid having to load them into one just to check the size, but it looks like i might have to do that anyway...

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Get Dimensions of Image

    You don't need to use a control. It loads the picture and converts width and height from Himetric (default), to Pixels..
    VB Code:
    1. Dim lPic As Picture, lHeight As Long, lWidth As Long    
    2.     Set lPic = LoadPicture("C:\Blue Gradient.gif") 'Load your picture here    
    3.     lWidth = ScaleX(lPic.Width, vbHimetric, vbPixels)
    4.     lHeight = ScaleY(lPic.Height, vbHimetric, vbPixels)    
    5.     MsgBox lWidth & "," & lHeight

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    9

    Re: Get Dimensions of Image

    Ahh, thanks jcis, i didnt know that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width