Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Code to load PNG

  1. #1

    Code to load PNG

    I want to load PNG's.

    I've found I can do it the long way: create a TBitmap, load the picture using "LoadFromFile", copy the image "pixel-by-pixel" to my own Bitmap structure and finally destroy the TBitmap. But this isn't a very "profiled" way.

    I'm wondering if it's possible to load a PNG bitmap using the FCL's TDecompressionStream, both use lzw algorithm, don't them?

    Savage suggested an implementation for Delphi here. I've "overview" it and seems nice, but it uses it's own deflating code and I was wondering if I can use FCL's one.

    Anyway if it's no possible I'll try to "translate" it. I would use Luuk van Venrooij's Image Converter and save all them as TGA or something (there are some hundreds of them) but it seems as it doesn't exist.
    No signature provided yet.

  2. #2

    Re: Code to load PNG

    Nuno, never found a stand along PNG loader myself . The one that is included in FPC/Lazarus requires 3rd party libs, Vampyre will load them without a 3rd party, but bloats the app due to everything else it can do.

    So far, Vampyre (http://imaginglib.sourceforge.net/) is the best solution I've found, though I wish I could find a PNG only loader

    - Jeremy

  3. #3

    Re: Code to load PNG

    use Vampyre, there is an .inc file where you can disable some unwanted features.
    From brazil (:

    Pascal pownz!

  4. #4

    Re: Code to load PNG

    Another vote for Vamypre from me.
    Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
    Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)

    Programmer: A device for converting coffein into software.

  5. #5

    Re: Code to load PNG

    Vampyre is ok, but the latest versions of Delphi have a native support for the PNG format.

  6. #6

    Re: Code to load PNG

    Quote Originally Posted by Brainer
    Vampyre is ok, but the latest versions of Delphi have a native support for the PNG format.
    Not quite correct. The latest versions of .NET have support for PNG and thus .NET apps (including Chrome/Delphi) have access. The "native" compiled versions still utilize API to load PNG's from the FS.

    If you want cross platform and FPC then your kinda stuck with Vampyre

  7. #7

    Re: Code to load PNG

    Quote Originally Posted by jdarling
    Not quite correct. The latest versions of .NET have support for PNG and thus .NET apps (including Chrome/Delphi) have access. The "native" compiled versions still utilize API to load PNG's from the FS.
    Not sure if I got it right, but as far as I know, Delphi loads the PNG format on its own using the pngimage unit, so I guess .NET is not needed.

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Re: Code to load PNG

    I believe I tried to add a screenshot feature to Garland's Quest recently amoung the formats I tried PNG was one of them. I had the header down no problems, however it was the compression of the actual pixel data that I was unable to figure out. I eventually settled on TGA, but it would have been nice to at least written raw PNG files. Or use simple RLE, but alas it seems that only LZH is used for PNG, no?

    I could post a snippet of my wip?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9

    Re: Code to load PNG

    Quote Originally Posted by jdarling
    Nuno, never found a stand along PNG loader myself . The one that is included in FPC/Lazarus requires 3rd party libs
    What do you mean by this? Lazarus's PNG works without getting anything extra. And after i just opened PNG source files (packages\fcl_image\src) they really don't have anything 3rd party in them.

    TPortableNetworkGraphic is found in Graphics unit.

  10. #10

    Re: Code to load PNG

    Vampyre Image Lib is probebly the best way to go. Supports everything you need. Also If you need my image converter just drop a line and I`ll upload it again.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •