APNG support (26)

APNG is an extension to PNG that adds animation, both Opera and Firefox have beta versions supporting it. Since it looks like APNG is unavoidable now, I've written a patch for wakaba that adds APNG support. (The problem is that APNGs get labeled as PNGs, thanks to mozilla being sneaky with the spec)

It'll name APNGs .apng instead of .png. You may need to do AddType image/png .apngto get them to not be marked as text/plain if you don't use mod-mime-magic. (Or whatever similar options exist for your webserver)

There is, and I'm currently writing up why.It's mainly because they're so new nothing non-beta supports them, and with imageboards that can easily lead to users being able to sneakily post things that you can't see, because they're using Firefox 3.0 and you're using Safari or something.

The obvious abuse would be a two frame APNG, with acceptable content in frame 0 (the one non-APNG browsers show) and something nasty in 1, like child porn.

>>4Wow, that's exactly what I thought when someone told me the Firefox 3 beta had APNG support ("Oh God, another way to post CP.") Not even a week ago or so, I was making a two frame APNG to post it on /a/ to check how many people had Firefox 3 (obviously harmless, it was something along the lines of that TTGL size chart/Yuyuko GIF), but I gave up when my image editor crashed on me.

I can't believe that, for once, 4chan admins preemptively solved a possible problem. Still a rather lame solution, I was looking forward to using APNGs with alpha transparency. Small clips from shows would also look a lot better without the 256 colors limitation.

That shouldn't be too hard, actually. Assuming Xee uses libpng, it should just be a matter of patching libpng with the patches Mozilla supplies:http://littlesvr.ca/apng/

I'm torn when it comes to APNG. On one hand, APNG is a sneaky "à lá Microsoft" hack (1. Reject standard, 2. Create alternative, 3. Propose it to the standards body, 4. Get rejected, 5. Implement it anyway). I would have preferred if it had a different mime type and extension altogether. Who wants animated images to be displayed as static PNGs, anyway? If people started seeing broken images everywhere, it would just be a motivation for them to upgrade their browsers.

On the other hand, MNG is bloated, over-engineered and its only implementation, libmng, is rather crappy, when you compare it with the robustness of libpng. The fact that we're long overdue for something like APNG doesn't help, either.

> I would have preferred if it had a different mime type and extension altogether.

I think the solution to that is for anyone who maintains a web site to reject the ".png" extension for apng files and use ".apng" instead, like bbwchan is doing now, to make it clear that it is a different kind of animal.

> Who wants animated images to be displayed as static PNGs, anyway?

The very same behavior happens for GIF files in viewers that don't have animated GIF support -- the wide majority of general-purpose image viewers only show the first frame. And how old are animated GIFs now?

> If people started seeing broken images everywhere, it would just be a motivation for them to upgrade their browsers.

No, it'd be motivation for them to not care. That logic might make sense in theory but it doesn't work in practice. Look how badly transparent PNG files have been broken in IE for years, and yet people continue to use it because not doing anything is easier.

All considered, I think it's a good concept with a sloppy and poorly-thought-out implementation.

> I think the solution to that is for anyone who maintains a web site to reject the ".png" extension for apng files and use ".apng" instead, like bbwchan is doing now, to make it clear that it is a different kind of animal.

It still uses the same mime type, though, which is annoying.

> The very same behavior happens for GIF files in viewers that don't have animated GIF support

Exactly. And it's a poor design, if you open a animated GIF with a viewer that doesn't support animation, you won't realize that it includes more than just one frame; you may even edit it without noticing and completely trash the animation after you save it.

IMO, this is just Mozilla repeating old mistakes all over again.

> No, it'd be motivation for them to not care.

Alright, I get the point. Thing is, the "graceful degradation" is pretty useless. No one uses a animated image file nowadays unless the animation IS important. Showing people the first frame of a animated image is just as bad as not showing them anything -- actually, it may be even worse; if the webmaster doesn't have a "THESE ARE ANIMATED PNG IMAGES" sign, people with browsers that don't support APNG may not even notice they're not seeing the full thing.

Serve them as video/x-apng. Only FF3a supports it at the moment anyway, so this is a very good time to influence the implementation if you disagree with it. There's no standard document saying "APNG should be served with MIME type image/png" yet.

> No one uses a animated image file nowadays unless the animation IS important.

I disagree, but we probably have much different definitions of "important". I agree with your last point, though; if people don't see something that's obviously broken, how will they know it is? Heck, people still see horrendously broken transparent PNG files in IE, and most "casual users" usually don't even question the fact that a site looks like crap. I asked a friend of mine to test the layout of a page I did once in IE, and he said it looked fine... two days later I checked it myself and it was horribly broken, squashed together, and parts were overlapping or missing altogether. I had to point out what, to me, were really obvious differences before he even noticed that it wasn't rendering correctly.

>>13You fucking idiot.I hope you die in flames of hell.Yeah, sure, someone might post CP, like he always does with gif, like he always does with transparent black/white pngs.Is this a reason to ban all apngs? What kind of nazi are you?

Your php code is a joke. Slurp whole file, string search for IDAT, string search for acTL; wow. surely no one would think of inserting tEXt chunk with IDAT as data.