Count Frames in an Animated GIF
The animated GIF always makes me chuckle; on one hand they seem like a relic of the "old web", on the other hand they aren't going anywhere and their meme-like presence seem to only make them more popular. If you browse through my media blog posts archives, you'll notice that I've written a ton about animated GIFs, including how to tell if a gif is animated, how to get a screenshot of the first frame, converting GIF to WEBP, and more.
My curiosity recently brought me to asking how to detect how many frames were present in an animated GIF; as expected, ImageMagick had the answer:
identify -format "%n\n" bitcoin.gif | head -n 1
What is this calculation useful for? I suppose if you have a media management site you could show each frame to a user so they could choose a
poster when converting to video. In any event, I was curious and simply had to find out!
I work with an awesome cast of developers at Mozilla, and one of them in Daniel Buchner. Daniel's shared with me an awesome strategy for detecting when nodes have been injected into a parent node without using the deprecated DOM Events API.
I love almost every part of being a tech blogger: learning, preaching, bantering, researching. The one part about blogging that I absolutely loathe: dealing with SPAM comments. For the past two years, my blog has registered 8,000+ SPAM comments per day. PER DAY. Bloating my database...
As more devices emerge and differences in device interaction are implemented, the more important good CSS code will become. In order to write good CSS, we need some indicator about device capabilities. We've used CSS media queries thus far, with checks for max-width and pixel ratios.
AJAX has become a huge part of the modern web and that wont change in the foreseeable future. MooTools has made AJAX so simple that a rookie developer can get their dynamic pages working in no time.
Step 1: The XHTML
Here we define two links...