Results 1 to 4 of 4

Thread: jpg gif size

  1. #1

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    I use common dialog to go to any folder and select a
    gif or jpg file to be moved into my image folder for later view via a pic display. Is there a way to get the properties of the picture file before I move it...I am concerned with the width and hight of the picture and it
    will be only jpg or gif.

    ie..
    if (selected picture).width > my size _
    or (selected picture).height > my size then
    msgbox...sorry picture is too large for program
    exit
    endif


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

    ___ Adolf Jensen

  2. #2
    Guest
    You can load it up in a hidden ImageBox and then check the Width and Height properties for it, then unload it and tell wheather it's too big or not.

  3. #3
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    this works for gif's, don't know about jpg though, I can't remember who wrote this it wasn't me, full credit to who ever it was.

    Function LoadImageData(FName As String) As String
    Dim Temp As String
    On Error GoTo FErrorLabel

    Open FName For Binary Access Read As #2
    Temp = String(FileLen(FName), Chr(0))
    Get #2, , Temp
    Close #2

    LoadImageData = Temp
    On Error GoTo 0
    Exit Function

    FErrorLabel:
    LoadImageData = ""
    MsgBox "File not found: " & FName
    On Error GoTo 0
    End Function



    to actually call it and find out the info

    Private Sub Command1_Click()
    tempinfo = LoadImageData("C:\yourgifhere.gif")
    MsgBox "Image Width: " & Asc(Right(Left(tempinfo, 7), 1))
    MsgBox "Image Height: " & Asc(Right(Left(tempinfo, 9), 1))
    End Sub


    but you are better to use Megatron's suggestion its a much easier way of doing it.


  4. #4

    Thread Starter
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    OK

    sounds like a plan...thanks both
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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