Results 1 to 11 of 11

Thread: about LoadImage(): what images files can read?

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    about LoadImage(): what images files can read?

    what images files the Loadimage() can read?
    (i understand that can read ico, cur, ani(by 1 subimage at a time, because they are cur image format) and bmp. but other images like png, jpg, gif????)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: about LoadImage(): what images files can read?

    I believe PNG is supported only in icons, i.e., individual images in an icon compressed using the PNG format. The LoadImage's uType parameter clearly states that only the following image types are supported:


    Value Meaning
    IMAGE_BITMAP
    0
    Loads a bitmap.
    IMAGE_CURSOR
    2
    Loads a cursor.
    IMAGE_ICON
    1
    Loads an icon.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by Bonnie West View Post
    I believe PNG is supported only in icons, i.e., individual images in an icon compressed using the PNG format. The LoadImage's uType parameter clearly states that only the following image types are supported:


    Value Meaning
    IMAGE_BITMAP
    0
    Loads a bitmap.
    IMAGE_CURSOR
    2
    Loads a cursor.
    IMAGE_ICON
    1
    Loads an icon.
    and the gif's??? what format they have? or are independent?
    (my bad... the ani is read with LoadCursorFromFile() and DrawIconEx() and DestroyCursor()(after we don't need it)
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by joaquim View Post
    and the gif's??? what format they have? or are independent?
    The GIF format is somewhat like PNG but LoadImage does not support it. Neither is JPEG.

    Quote Originally Posted by joaquim View Post
    (my bad... the ani is read with LoadCursorFromFile() and DrawIconEx() and DestroyCursor()(after we don't need it)
    LoadImage can, in fact, load animated cursors:

    Quote Originally Posted by MSDN
    Loads an icon, cursor, animated cursor, or bitmap.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by Bonnie West View Post
    The GIF format is somewhat like PNG but LoadImage does not support it. Neither is JPEG.



    LoadImage can, in fact, load animated cursors:
    ok, is there another API function for read the jpeg and png?
    i have code for read png but it's very complext for translate... so is there another API function?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  6. #6
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: about LoadImage(): what images files can read?

    Well GDI+ should be able to deal with PNGs but the API is a little more complicated that regular old GDI. If you're using VB6 and want PNG support then I recommend using the FreeImage library. I've used it in the past and its really great.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  7. #7

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by Niya View Post
    Well GDI+ should be able to deal with PNGs but the API is a little more complicated that regular old GDI. If you're using VB6 and want PNG support then I recommend using the FreeImage library. I've used it in the past and its really great.
    sorry.. in these case isn't for VB6, that's why i ask for another API function.
    anotherthing: what is metafile?
    VB6 2D Sprite control

    To live is difficult, but we do it.

  8. #8
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by joaquim View Post
    anotherthing: what is metafile?
    If I'm not mistaken, I think it's a file that describes another file.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  9. #9
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: about LoadImage(): what images files can read?

    An image file essentially records the values and arrangement of pixels. A metafile is vector based. In other words it records instructions for drawing the image rather than the image itself. This is specifically designed to make scaling of the image over large ranges possible without quality loss which is why it has tended to be the format of choice for clipart, for example.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  10. #10

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,904

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by dunfiddlin View Post
    An image file essentially records the values and arrangement of pixels. A metafile is vector based. In other words it records instructions for drawing the image rather than the image itself. This is specifically designed to make scaling of the image over large ranges possible without quality loss which is why it has tended to be the format of choice for clipart, for example.
    thanks to all
    VB6 2D Sprite control

    To live is difficult, but we do it.

  11. #11
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: about LoadImage(): what images files can read?

    Quote Originally Posted by joaquim View Post
    sorry.. in these case isn't for VB6, that's why i ask for another API function.
    anotherthing: what is metafile?
    Then I guess your only route may be GDI+.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

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