CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    123

    Get image dimensions

    When I mouse over image files in Explorer, the dimensions of the image along with file size display in a tooltip popup.

    Is there a simple command that will provide the dimensions of an image file given the path of the image file?

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: Get image dimensions

    Quote Originally Posted by Bob H
    When I mouse over image files in Explorer, the dimensions of the image along with file size display in a tooltip popup.

    Is there a simple command that will provide the dimensions of an image file given the path of the image file?
    What kind of Images? If you deal with bmp you can use ::LoadImage() and ::GetObject() ( look at this thread for sample ).

    If you need to deal with other image formats i can suggest you to use Image Class of GDI+.

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    Apr 1999
    Posts
    123

    Re: Get image dimensions

    All image formats (jpg, gif, png, etc).

    I believe that GDI+ only comes with Windows XP. I don't want to have to dramatically alter my program and installation to simply get image dimensions.

  4. #4
    Join Date
    May 2005
    Posts
    4,954

    Re: Get image dimensions

    Quote Originally Posted by Bob H
    All image formats (jpg, gif, png, etc).

    I believe that GDI+ only comes with Windows XP. I don't want to have to dramatically alter my program and installation to simply get image dimensions.
    In that case you will need to find lib(s) that know(s) how to handle different image file formats.
    Look at CxImage it might give you good start.

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

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

Featured