0

I thought you maybe could help me out here :-)
So I just launched my website, where I will upload some GIFs and have them displayed on the front page.
As of right now, I use a script to show a .png file, when a mouse is hovered, the .gif shows and you can click on it, which will link you to the .gif file.

So right now I got two files for every GIF; xxx.gif and xxx_thumb.png -- however, I would like this to get automatized and thought of a simple script.
In pseudo code:

get .gif
  rename to 1.gif
    if 1.gif taken? rename to 2.gif
  get first frame
    export first frame as 1_thumb.png
      if 1_thumb.png taken? rename to 2_thumb.png
load new picture? (y/n)
  if n
    exit
  if y
    start from step 1

Something like this would be awesome -- how hard would it be to code? Would Ruby or Python do the job?
Would this be possible with a web app, then send the .gif + .png as an email to me? <-- not necessary yet :-)

Thanks for reading this!

Filuren
  • 661
  • 2
  • 7
  • 19
  • http://stackoverflow.com/questions/4904940/python-converting-gif-frames-to-png – yurib Feb 15 '12 at 00:21
  • Ruby would be very easy to use. So what happens if 2.gif is already taken? Would it go to 3.gif? – MiJyn Feb 15 '12 at 00:22
  • If you host the GIF on the same web server as your HTML, it would be very easy to draw an animated GIF to an HTML5 Canvas, then use `toDataURL()` to create a base64 encoding of PNG data. From there you could submit a form with that data to your server, decode the base64 and write the PNG to disk if desired. – Phrogz Feb 15 '12 at 00:22
  • Yup, just like that lkjoel -- if name is in use, add 1 and try again – Filuren Feb 15 '12 at 00:24

1 Answers1

0

For Ruby you could check out rmagick and while this is for an older version of Rails it starts the process you would follow.

ScottJShea
  • 7,041
  • 11
  • 44
  • 67