Thread: Image Size

  1. #1
    Compiling
    Join Date
    Jun 2003
    Posts
    69

    Question Image Size

    Hello all,
    I am dealing with some pictures with visual c++.net, but now I have a problem that how to get the original size of an image.
    I can first invisible a PictureBox and put the image in it with the SizeMode AutoSize, then use the member function of PictureBox Size to get the image size. But are there any simpler methods do the same thing? Thanks!

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Each different image file type should have information stored in it that indicates in some manner the size/dimensions of that image. Are you working with JPEG/TIFF/GIF/BMP, etc... Go to http://www.wotsit.org and look up the type of image files you are dealing with. You can download documentation on the format of the data stored in those files and develop code to parse the headers of those files.

    As for this being an easier method... well, the other way seems sort of hackish but if it works then stick with it.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Use the properties of the Image object.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Trouble with DMA Segmentation Faults
    By firestorm717 in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 09:20 PM
  3. Replies: 6
    Last Post: 03-03-2005, 03:52 AM
  4. Changing a treeview item's image
    By SMurf in forum Windows Programming
    Replies: 0
    Last Post: 01-14-2003, 07:08 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM