So I have a few animation strips in BMP format. I'd like to know if there's a fast and convenient way to save every single 'frame' of the strip image as a separate (pcx) file?
Doing it manually is beyond tedious.
Saving individual frames from a strip animation
- [did]Madis
- Adept
- Posts: 297
- Joined: Tue Jun 03, 2008 2:48 pm
- Personal rank: カニはとても美味しい
- Phorce
- Experienced
- Posts: 107
- Joined: Tue Apr 14, 2009 8:24 pm
- Personal rank: Sgt. Nutz
- Location: UK
- Contact:
Re: Saving individual frames from a strip animation
I did this with an Imagemagick script once. Write a for loop and increment the pixel count each time so that each frame gets cut out.
"Weapons! ... for all occasions." Bill Hicks
- [did]Madis
- Adept
- Posts: 297
- Joined: Tue Jun 03, 2008 2:48 pm
- Personal rank: カニはとても美味しい
Re: Saving individual frames from a strip animation
I'm not familiar with this program. How do I make it cut out 36 128x128 frames out of a 4608x128 strip?Phorce wrote:I did this with an Imagemagick script once. Write a for loop and increment the pixel count each time so that each frame gets cut out.
- Phorce
- Experienced
- Posts: 107
- Joined: Tue Apr 14, 2009 8:24 pm
- Personal rank: Sgt. Nutz
- Location: UK
- Contact:
Re: Saving individual frames from a strip animation
http://en.wikipedia.org/wiki/Imagemagick
I think I still have the script somewhere. I'll dig it out.
I think I still have the script somewhere. I'll dig it out.
"Weapons! ... for all occasions." Bill Hicks
- [did]Madis
- Adept
- Posts: 297
- Joined: Tue Jun 03, 2008 2:48 pm
- Personal rank: カニはとても美味しい
Re: Saving individual frames from a strip animation
I'd appreciate it.Phorce wrote:http://en.wikipedia.org/wiki/Imagemagick
I think I still have the script somewhere. I'll dig it out.
- Phorce
- Experienced
- Posts: 107
- Joined: Tue Apr 14, 2009 8:24 pm
- Personal rank: Sgt. Nutz
- Location: UK
- Contact:
Re: Saving individual frames from a strip animation
Here it is.
Requires ImageMagick. Only in Linux bash at the moment although I suppose it could be interesting doing it in Windows/DOS. There is no error checking so if you get strange results double check the input numbers.
Code: Select all
#!/bin/bash
# Extract Animation Strip - DJ Barney / Phorce, April 2010
# Assumes left to right operation. Requires ImageMagick - http://www.imagemagick.org
# Command line: extract-animation-strip <image-file-name> <total-width> <single-frame-width> <single-frame-height>
image=$1
totalwidth=$2
framewidth=$3
frameheight=$4
count=1
offset=0
while [ "$offset" -lt "$totalwidth" ] ;
do
convert $image -crop "$framewidth"x"$frameheight"+$offset+0 $image$count.png;
offset=`expr $offset + $framewidth`;
count=`expr $count + 1`;
done;
"Weapons! ... for all occasions." Bill Hicks