• Delete existing APNGs?
    174 replies, posted
I'm one of the few who think they shouldn't be animated. It doesn't bother me the few that are there now, but if it were allowed then some time in the future the majority of the sidebar would be animated as you scroll through a thread which would be rather annoying.
Offer the option then in settings to "disable animated backgrounds" or even better - don't animate them until they play. Granted it'll result in two different images, one still from the first frame and one animated, but it'd be a neat solution.
Both of which are easier said than implemented for sure.
I recall people saying this wouldn't be a problem with APNGs because you can truncate everything except the first frame to make it a still image or something along those lines. Would be a clever way to handle it and ditch .gifs at the same time, assuming I'm not talking completely out of my ass.
I mean not entirely? You act like it's some sort of massive feat that'll take weeks to code.
No but it's definitely not trivial. And on the list of things that need implementing.... well
my understanding is that showing the first frame of an APNG is more difficult because you have to manually (using manually to mean not easily algorithmically solved) pull out the first frame data and fix the header/footer to have it not animate is it possible? yeah, does it make sense for garry to do given he doesn't want animated at all, probably not
The beauty on how the images work though is that you don't entirely need javascript for them to display properly, everything is just a background-image rule. You can say the same about hover though, BUT if you wanted to do this, you will need to hold at least two references to the image. For example, two images, one animated, one not. Or two URLs, for the backend to provide a static and an animated off a single image.
make existing ones only show the first frame
the problem is there's no magic "make apngs not be apngs" button that i can find
In that case facepunch could just keep two versions of background - original animated one and processed non-animated one, user setting will define which one should be served. pretty sure there should be decent tools for that
So I tried a thing I wouldn't recommend at all > ffmpeg -i "toast bg converted.png" "toast bg converted2.png" It spat some shit out [image2 @ 00000000027d4240] Could not get frame filename number 2 from pattern 'toast bg converted2.png' (either set updatefirst or use a pattern like %03d within the filename pattern) av_interleaved_write_frame(): Invalid argument frame=    9 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.20 bitrate=N/A dup=3 drop=0 speed=26.6x video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! But, it actually did spit out a 2kb png file of the first frame But really, just wait until administrators (postal) have access to administrating this content, he's mentioned changing them when it comes around
But that is @postal 's opinion, we still haven't heard @garry 's decision.
there should be an option to purchase animated backgrounds but make it expensive, animated backgrounds are cool
I'm barely capable of programming in C and made a simple 50 line program that can do it, so it's kinda trivial. #include <stdio.h> #include <stdint.h> #include <string.h> #include <endian.h> static const char sig[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }; static const char skip[][4] = { "acTL", "fcTL", "fdAT" }; int inskip(const char *s) {     for (int i = 0; i < sizeof(skip)/4; ++i)         if (!strncmp(s, &skip[i][0], 4))             return 1;     return 0; } int main(void) {     uint32_t chlen;     char chtmp[8];     fread(chtmp, 1, 8, stdin);     if (strncmp(sig, chtmp, 8)) {         fprintf(stderr, "Not a png\n");         return -1;     }     fwrite(chtmp, 1, 8, stdout);          for (;;) {         fread(&chlen, 1, 4, stdin);         fread(chtmp, 1, 4, stdin);         if (inskip(chtmp)) {             for (int i = 0; i < be32toh(chlen)+4; ++i)                 getchar();             continue;         } else {             fwrite(&chlen, 4, 1, stdout);             fwrite(chtmp, 1, 4, stdout);             for (int i = 0; i < be32toh(chlen)+4; ++i)                 putchar(getchar());         }         if (!strncmp("IEND", chtmp, 4))             break;     }     return 0; } Demo using Dapoel's avatar: $ ls apng1.png  apng_strip $ ./apng_strip < apng1.png > png1.png $ du -h * 1.7M    apng1.png 12K    apng_strip 88K    png1.png Output file: https://files.facepunch.com/forum/upload/140792/0df3b50b-230b-49cf-b546-f0c76ade7acc/png1.png
Does it still download the entire file, though? One issue is animation, a different one is size.
Depends how it's implemented, this could be done on the server (small file, big animated files on request), or on the client (big file only). Doing it on the client means you don't solve that size issue
I mean there's the file size limit now so I guess the size isn't that bad. But his solution spits out 2 files, it's up to garry on how they're served. You could only download one file and present that in the background, then download the other file upon hover, but that would result in a stuttery image while it loads, and even then you're not saving that much data, when someone can just upload a 256kb jpeg as a static background anyway. The other option is preloading the animated one so it shows on hover ready loaded, but then you're still loading 2 images, so that only really appeases the people who find them too distracting
Offer a setting to disable the "animate on hover" as well as just disable it on mobile and you'll offer solutions for all then.
Sorry, you need to Log In to post a reply to this thread.