views:

42

answers:

1

Hello, SO!

I'm messing around with rails and hope to try some different image manipulation techniques. My main goal is to learn more about different image formats and the various ways to interact with them.

The first thing I'm attempting to do is split the frames in a GIF image and randomly reorder them into a new image. I've researched enough to know to use RMagick and plan to install it the next time I decide to sit down and work on this. The one thing I haven't been able to find is documentation on creating GIF images at all, let alone isolating the frames of an existing GIF.

Does anyone have any resources or experience in doing what I'm talking about? If so, could you give me a general area to start tinkering?

+1  A: 

Check out gifsicle - http://www.lcdf.org/gifsicle/

Jamie Wong
This looks pretty promising. I'm still a rails newb, though. I'm unsure how I'd interface *nix command line commands with the project.
treefrog
Check out http://apidock.com/ruby/Process/exec/class
Jamie Wong
Upon further analysis and research of the RMagick API, I've found that it does support extracting GIF frames. I'll try to write a solution tonight after work and if I have any luck I'll post it. If it looks like a lost cause I'll try out gifsicle. Thanks for the response though!
treefrog
@rofly It does support extracting GIF frames, but I seem to remember it was a gigantic pain to try and reconstruct them into animations using ImageMagick. I also seem to remember gifsicle being a hell of a lot faster at constructing GIFs.
Jamie Wong
I won't argue with experience, I'll try the gifsicle route first then. From what I've read of it it does seem like it would be a lot less of a headache. I might try the RMagick route afterwards just to see if I can.
treefrog
Jaime, I finally got around to tinkering with this, and from the ruby console I'm unable to find the images. exec 'ls -l' returns the working directory and I append from that. is there some sort of behavior I have to take note of when accessing and altering files with exec?
treefrog
You probably don't want to use `ls` to traverse directories in ruby. If you want to grab files from the current directory, use `Dir.foreach(".") {|f| puts f}`
Jamie Wong