Author Topic: libpng  (Read 775 times)

NoCforMe

  • Member
  • ****
  • Posts: 842
Re: libpng
« Reply #15 on: October 11, 2022, 09:02:11 AM »
I know GDI+ handles JP(E)G, GIF (and of course BMP), but does it know how to handle PNG? or WebP? (Pretty sure it doesn't do the latter.)
Then there's TIFF ...

jj2007

  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: libpng
« Reply #16 on: October 11, 2022, 10:06:35 AM »
Test it...

Code: [Select]
GuiParas equ "Gdi+ rocks - drag an image file over the exe", w300, h500
guiTimerMs=500 ; a slow timer
include \masm32\MasmBasic\Res\MbGui.asm
Event Paint
  .if CL$() ; commandline supplied?
GuiImage eax, fit
  .else ; otherwise use an image from the web
GuiImage "http://www.jj2007.eu/pics/animated.tif", fit
  .endif
Event Timer
  GuiCls ; animated images need this ;-)
GuiEnd

Source & exe attached. See CL$(), Event, GuiImage

No idea why they insist to call it "multi-page tif", it works exactly like an animated gif. Unfortunately, it is very difficult to find an animated tif on the web. And of course, you are right about webp - that's too recent for Gdi+ :sad:
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

TimoVJL

  • Member
  • *****
  • Posts: 1223
Re: libpng
« Reply #17 on: October 11, 2022, 10:51:59 AM »
Wasn't TIFF a scanner / fax picture format with multiple pages.

nickname_
”TIFF: Thousands of Incompatible File Formats”
« Last Edit: October 14, 2022, 05:42:24 PM by TimoVJL »
May the source be with you

NoCforMe

  • Member
  • ****
  • Posts: 842
Re: libpng
« Reply #18 on: October 11, 2022, 11:03:53 AM »
Yes it was, although it's certainly not limited to fax or low-res scanned images.

Tagged Image File Format. The "tagged" is what's nice about this implementation: the format includes many possible sections, each identified by a "tag" (a unique binary value). If a TIFF reader comes across a section it doesn't understand, it can simply skip over it, as each section contains a field which lets you find the next section. So it's very backwards-compatible.

TIFF was used a lot (still is used?) by places that do very high-resolution scanning, like for art books and the like. It's probably been replaced by other formats for the most part.

Biterider

  • Member
  • *****
  • Posts: 1043
  • ObjAsm Developer
    • ObjAsm
Re: libpng
« Reply #19 on: October 13, 2022, 07:00:30 PM »
Hi
I had a few days off and am surprised to see all of these posts today.  :thumbsup:

As we all know, to load PNG and other common formats from files, the commonly accepted solution is using GDI+ and in most cases that's perfectly fine.
The idea behind my post about using other libraries is to explore code alternatives, in this case the original code base of the creators of PNG. If you take a closer look, they provide a lot of functionality that you don't have in GDI+.

My motto is don't close your eyes to alternatives to the established and always stay curious, even if it's sometimes a bit difficult and tedious.
It always pays off.  :cool:

Biterider

caballero

  • Member
  • *****
  • Posts: 2028
  • Matrix - Noah
    • abre ojos ensamblador
Re: libpng
« Reply #20 on: October 14, 2022, 12:46:00 AM »
The logic of the error is hidden among the most unexpected lines of the program