Results 1 to 6 of 6

Thread: Image attributes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    81

    Talking

    Hey fellers,

    how can I find the height and width of a bitmap before I display it in a picture box?

    Cheers!

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    [code}
    'add a second picture box invisible

    Private Sub Command1_Click()
    Set Picture1 = LoadPicture("C:\images\dirtbagdog.jpg")

    MsgBox Picture1.Picture.Width & " " _
    & Picture1.Picture.Height

    Set Picture1 = LoadPicture()

    End Sub

    [/code]
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    Or without the invisible picturebox

    Code:
    Dim pic As IPictureDisp
    Set pic = LoadPicture("SomePicture.bmp")
    MsgBox pic.Height & " " _
    & pic.Width
    Picture1.Picture = pic

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'that will work
    'I would add this to get rid of unneeded baggage
    'ie memory
    'unload the picture and dump the object

    Set pic = LoadPicture()
    Set IPictureDisp = Nothing
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    81

    Cool Cheers

    cheers guys. I'd tried that before - I've tried about everything, but I omitted the "Set" in "Set pic= etc.", and it wouldn't work. I don't doubt it'll work now - thanx again...

  6. #6
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Read the file header. You can get information about the header on www.wotsit.org

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