!!c1QfXUgcGY0

Fun with the command line

gutsygumshoe:

Terezi doodling things with chalk on LOTAF!

I’m not so sure if I like how this turned out hmm. Fullview here!

So, if you scale a delta-compressed GIF file using imagemagick, it looks lousy. This is because a delta frame is going to contain lots of single-pixel data, which won’t survive cubic scaling. (I assume Tumblr uses imagemagick, the standard Linux suite of command-line image manipulation tools)

This can easily be observed in the wild:

$ wget https://s3.amazonaws.com/data.tumblr.com/tumblr_lwoh2iFRAA1r18yoxo1_1280.gif
--2011-12-23 15:05:30--  https://s3.amazonaws.com/data.tumblr.com/tumblr_lwoh2iFRAA1r18yoxo1_1280.gif
Resolving s3.amazonaws.com... 207.171.185.200
Connecting to s3.amazonaws.com|207.171.185.200|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 173368 (169K) [image/gif]
Saving to: `tumblr_lwoh2iFRAA1r18yoxo1_1280.gif'

100%[=============================================================================================================>] 173,368      177K/s   in 1.0s    

2011-12-23 15:05:31 (177 KB/s) - `tumblr_lwoh2iFRAA1r18yoxo1_1280.gif' saved [173368/173368]

$ convert -geometry 500 tumblr_lwoh2iFRAA1r18yoxo1_1280.gif foobar.gif
$ display foobar.gif

Ideally, we’d just tell imagemagick to convert it to an uncompressed form, scale it, then run a new delta-compression pass. There’s probably a cheap, easy way to do that, but five minutes of googling didn’t find one. So I made an ugly hack:

$ convert -geometry 500 'tumblr_lwoh2iFRAA1r18yoxo1_1280.gif[0-9]' images.mng
$ convert -layers optimize images.mng foobar.gif

MNG is the animated version of PNG. [0-9] tells imagemagick to pull frames 0 through 9, -geometry 500 tells it to scale the longest dimension to 500 pixels, then it writes the composite set of layers to disk. Then we convert the MNG file back to GIF, using -layers optimize to delta-compress it. (Foobar is a standard hacker metasyntactic variable)

Here’s the result:

3:19pm | URL: http://tmblr.co/ZStnmwDhj_p1
(Notes:228)
Filed under:linux imagemagick
  1. thenewgear reblogged this from fuckyeahmspagifs
  2. l3monsnout1sgu1lty reblogged this from roselalonde
  3. roselalonde reblogged this from fuckyeahmspagifs
  4. thattrollwiththehorns reblogged this from vrisglare
  5. lolikonnichiwa reblogged this from majyyk
  6. majyyk reblogged this from beepony
  7. smugleaf42 reblogged this from gumiira
  8. spinalism reblogged this from fuckyeahmspagifs
  9. beepony reblogged this from fuckyeahmspagifs
  10. bunnyfan194 reblogged this from fuckyeahmspagifs
  11. trollmegle-my-eggo reblogged this from fuckyeahmspagifs
  12. shaylerz reblogged this from fuckyeahmspagifs
  13. 2xknifekind reblogged this from vrisglare
  14. shimurs reblogged this from fuckyeahmspagifs
  15. happuhappu reblogged this from fuckyeahmspagifs
  16. hdp-goes-honk reblogged this from fuckyeahmspagifs
  17. vvooper reblogged this from fuckyeahmspagifs
  18. imdabes reblogged this from fuckyeahmspagifs
  19. vrisglare reblogged this from fuckyeahmspagifs