Regressive JPEGs
329 points
6 hours ago
| 16 comments
| maurycyz.com
| HN
Retr0id
21 minutes ago
[-]
I did something very similar with progressive (adam7 interlaced) PNG: https://www.da.vidbuchanan.co.uk/adamation/image.png

> so playback is entirely dependent on network delay

Ultimately true, but I set up my server to send each "frame" separately, with a fixed delay between each. Each frame is small so unless your network is unusually slow, the timing is set by my server.

reply
jbochi
14 minutes ago
[-]
And I did something similar to steam live video via an infinite gif: https://github.com/jbochi/gifstreaming#live-video-streaming-...
reply
pavlov
3 minutes ago
[-]
> “Besides unconventional rickrolls and other trolling, this has no practical applications: there's no way to add timing information, so playback is entirely dependent on network delay.”

A progress bar for something that’s loading in parallel over the same network, to give the user an idea of how much the delay is?

reply
robbak
2 hours ago
[-]
That is 1. Cursed, and 2. Definitely in the right place here.
reply
alterom
1 hour ago
[-]
This is the stuff that I come here for.
reply
wegwerf17377382
23 minutes ago
[-]
Me too, thanks for reminding me of that
reply
tda
55 minutes ago
[-]
I wonder if and how you can use this for steganography, hiding data in plain sight. I bet most automated image analysis programs would only consider the final image. I sure some highschooler can use this to bypass their schools contentfilter
reply
aetherspawn
29 minutes ago
[-]
Yep this is an AI subversion technique for sure. Put the message to the humans in the first frame, and the message to the AI in the final frame.

This is how we defeat skynet: by sending each other pictures of cats.

reply
mike_hock
10 minutes ago
[-]
I can't see any way this would beat regular steganography.
reply
cousin_it
3 hours ago
[-]
Nice! I think you can approximate timing somewhat, by making your web server create the "jpeg" on the fly and send it to the client in timed chunks. The source could even be a webcam, so the "jpeg" would go on forever.
reply
londons_explore
2 hours ago
[-]
There are already webcams which do this- but they use a mime trick for 'multipart/x-mixed-replace'.

That's basically the server telling the client 'That data I just sent you, well now replace it with this new thing'.

No JavaScript needed, and can work with plain http and jpeg

reply
SahAssar
1 hour ago
[-]
A lot of IP cameras already do this via https://en.wikipedia.org/wiki/Motion_JPEG
reply
iwontberude
46 minutes ago
[-]
You can do this with the gif too, I have once created a toy cgi that combined a gif sending one frame at a time with an image map allowing you to Remote Desktop with no JavaScript and click around. JPEG may have been a better choice, maybe I’ll revisit this.
reply
est
1 hour ago
[-]
> so playback is entirely dependent on network delay

You can use Service Worker to emulate a slow connection :)

reply
Yokohiii
56 minutes ago
[-]
Adjacent advice: I've recently played with opengl and jpeg turbo and I wanted to display images fast. I don't remember exact numbers, but enabling progressive for a jpeg was a significant slowdown for decoding. So if anyone like me is stuck with the old school advice that progressive is an nice to have, it's likely not. I personally don't remember any visual progressive image buildup in like decades, so it's not doing anything valuable at all.
reply
chronogram
22 minutes ago
[-]
I use cjpegli as encoder and it compresses best with its default progressive and full 4:4:4 approach, so it's not only a nice to have feature.
reply
Self-Perfection
36 minutes ago
[-]
JPEG photos stored as progressive usually take ~5% less space so there is value.

And it is possible to losslessly transcode JPEG to progressive.

Lossless transcoding to JPEG XL gives even more space savings though.

reply
cubefox
40 minutes ago
[-]
Progressive decoding isn't expected to speed up decoding, it's expected to speed up displaying large image files, especially for downloads via slow mobile connections.

Example: https://youtube.com/watch?v=UphN1_7nP8U

reply
schobi
3 hours ago
[-]
I tried to think about difficult ways to compute the high frequency coefficients to work from the "wrong" coefficients of the first image...

But this is clever - just smash them together. Low frequency of one image concatenated with high frequency from another. This works surprisingly well!

reply
xnx
2 hours ago
[-]
Excellent hack! Should definitely be possible to make an animated gif to jpeg converter. I guess the animation could be slowed a little by repeating frames.
reply
londons_explore
2 hours ago
[-]
You can also deliberately have the server sending data at the right rate for the right playback time.

Easy enough to add a delay() each frame if your server is python/nodejs/PHP/whatever

reply
vanderZwan
1 hour ago
[-]
I wonder if you can do this in JPEG-XL. I know that that has actual animation support, but this would be a different thing.
reply
cyberrock
1 hour ago
[-]
The format supports progressive decoding but IIRC none of the current browser implementations support it. The first Chrome and Firefox implementations did, and I think it's on their roadmap for the new Rust implementation. No idea about WebKit/Safari.

Edit: the format also supports region-of-interest decoding and I suspect you can make some cool maps or fractal images with both features. But I think they're not quite prioritizing implementing that right now.

reply
Grimblewald
1 hour ago
[-]
insanity of content aside, that's a really nice website. Kudos.
reply
korbatz
1 hour ago
[-]
If the online porn industry hasn't used it, it's probably worthless. Still funny, though.
reply
LoganDark
1 hour ago
[-]
Safari just freezes in place until the image is entirely finished downloading.
reply
aetherspawn
31 minutes ago
[-]
Works fine for me on iOS
reply
solodynamo
1 hour ago
[-]
hmm interesting
reply
ilvez
2 hours ago
[-]
My jaw dropped. Very cool. Thanks for sharing.
reply
Pijuspaul321
1 hour ago
[-]
Thanks for sharing
reply