Forum > Graphics

[Fun Fact] PNG and Microsoft (also BMP)

(1/2) > >>

domasz:
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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TCompressionStream.Create(clFastest, DestStream, False); //ZLIBI did:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TCompressionStream.Create(clFastest, DestStream, True); //pure DeflateIt 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.

MarkMLl:
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

Boleeman:
It's interesting that the image opens in MsPaint, Paint 3D, Photos, Paint.Net but not Greenfish Icon Editor and the Web browsers.

domasz:
Thanks for reporting more programs :)

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

domasz:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version