Recent

Author Topic: [Fun Fact] PNG and Microsoft (also BMP)  (Read 2417 times)

domasz

  • Hero Member
  • *****
  • Posts: 554
[Fun Fact] PNG and Microsoft (also BMP)
« on: March 25, 2024, 09:26:23 am »
Something I discovered. Rather not useful but I found it interesting and confusing.

PNG images use Deflate compression as stated in the specification. It is also stated that the Deflate data should be wrapped in Zlib headers.
I wrote my own little PNG compressor and instead of:
Code: Pascal  [Select][+][-]
  1. TCompressionStream.Create(clFastest, DestStream, False); //ZLIB
I did:
Code: Pascal  [Select][+][-]
  1. TCompressionStream.Create(clFastest, DestStream, True); //pure Deflate
It created an image which could not be opened in Firefox, Chrome, XnView, Corel, IrfanView but worked fine in Paint, Paint 3D, Microsoft Photos, Sumatra PDF.

The image might be used to see what programs decode PNG images using Windows built-in decoder.
« Last Edit: March 26, 2024, 10:22:00 am by domasz »

MarkMLl

  • Hero Member
  • *****
  • Posts: 8129
Re: [Fun Fact] PNG and Microsoft
« Reply #1 on: March 25, 2024, 10:01:38 am »
You might have stumbled across something "legacy" there: remember that originally the zip-type algorithms were encumbered by patents owned by Unisys and others.

See http://www.faqs.org/faqs/compression-faq/part1/section-7.html and specifically note the Stac v Microsoft sections.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Boleeman

  • Hero Member
  • *****
  • Posts: 768
Re: [Fun Fact] PNG and Microsoft
« Reply #2 on: March 26, 2024, 06:44:26 am »
It's interesting that the image opens in MsPaint, Paint 3D, Photos, Paint.Net but not Greenfish Icon Editor and the Web browsers.

domasz

  • Hero Member
  • *****
  • Posts: 554
Re: [Fun Fact] PNG and Microsoft
« Reply #3 on: March 26, 2024, 09:28:27 am »
Thanks for reporting more programs :)

I wonder if there is any program for Linux or MacOS that could read this funny PNG.

domasz

  • Hero Member
  • *****
  • Posts: 554
Re: [Fun Fact] PNG and Microsoft (also BMP)
« Reply #4 on: March 26, 2024, 10:27:24 am »
And here's another fun fact- BMP is s way more complicated format than most people think.

Standard BMP files are: 1, 4, 8, 16, 24 or 32 bits per pixel.
However Microsoft invented also 2 bpp .BMPs and used them in Windows CE.

Most .BMP reading programs can't handle them (IrfanView, Corel, Firefox, LibreOffice, Paint, Paint 3D, Photos). They can be opened with XnView, Chrome and Microsoft Edge.

Ten_Mile_Hike

  • Jr. Member
  • **
  • Posts: 91
Re: [Fun Fact] PNG and Microsoft (also BMP)
« Reply #5 on: April 18, 2024, 06:24:19 pm »
The interesting story of the Microsoft engineer who first coded "zip" into Windows
(he also created Task Manager)
https://www.youtube.com/watch?v=aQUtUQ_L8Yk
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.

Robert A. Heinlein

 

TinyPortal © 2005-2018