Live data from Hacker News

A file that’s both an acceptable HTML page and a JPEG (2012)

lcamtuf.coredump.cx

41–50 of 72 posts

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#43
It's a pity that phones recompress the JPG when doing Save To Camera Roll.

I'd like to build a system for distributing mini-apps as images, bypassing the App Store.

A JavaScript bookmarklet could be used to provide a basic "bootloader" that provides an "upload image" button. Then a binary representation of the HTML could be loaded from the image data.

The problem I had was lossy recompression - colours bleed across edges, so the binary data was corrupt after the first save. I'm still not sure how to work around that problem.

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#45
post #29

Earlier quoted context omitted.

https://en.wikipedia.org/wiki/Squirrel > Squirrels are members of the family Sciuridae, a family that includes small or medium-size rodents. The squirrel family includes tree squirrels, ground squirrels, chipmunks , marmots (including woodchucks), flying squirrels, and prairie dogs amongst other rodents. (TLDR, chipmunks are squirrels)

The Sciuridae family includes chipmunks; that doesn't mean chupmunks are squirrels, nor that marmots are squirrels.

https://en.wikipedia.org/wiki/Marmot

> Marmots are large squirrels

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#46

It's a pity that phones recompress the JPG when doing Save To Camera Roll. I'd like to build a system for distributing mini-apps as images, bypassing the App Store. A JavaScript bookmarklet could be used to provide a basic "bootloader" that provides an "upload image" button. Then a binary representation of the HTML could be loaded from the image data. The problem I had was lossy recompression - colours bleed across e…

Some kind of redundancy?

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#47
post #35

Earlier quoted context omitted.

While definitely cool, I wonder how effective this is. Code/random binary data should have different characteristics than image data.

DEFLATE, which is used by PNG, is a general purpose LZ77-like compression algorithm suitable for all kinds of repetitive data.

PNG filters each horizontal line of the image data before running it through Deflate, with a pre-processing step.

Each of the possible filters is very simple, but the difference between a great PNG exporter, a mediocre one, and a trash fire is the use of a heuristic to decide which of the pre-processing filters should be applied to each line of output. libpng, the free implementation, includes a heuristic that does a fairly OK job, if you just don't implement a heuristic and use no filtering at all, the results are enormous PNG files as seen in turn of the century Adobe Photoshop. So, no, a general purpose compression algorithm isn't very good for image data on its own.

(Choose for yourself whether you think Adobe wanted to discourage use of a popular free image format in favour of licensed formats for which it held relevant IP, or their development team are just incompetent morons, or both).

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#48

It's a pity that phones recompress the JPG when doing Save To Camera Roll. I'd like to build a system for distributing mini-apps as images, bypassing the App Store. A JavaScript bookmarklet could be used to provide a basic "bootloader" that provides an "upload image" button. Then a binary representation of the HTML could be loaded from the image data. The problem I had was lossy recompression - colours bleed across e…

Try to use metadata sections and hope they won't be dropped during the re-save?

Re: A file that’s both an acceptable HTML page and a JPEG (2012)

#49
post #40

But what does the Unix "file" command say?

  $ curl -s http://lcamtuf.coredump.cx/squirrel/ | file -
  /dev/stdin: JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, comment: "body { visibility: hidden; } .n { visibility: visible; position: absolute; ", baseline, precision 8, 1000x667, frames 3
file(1) version 5.32-2ubuntu0.1.
Post reply on HN