SpaceApple
SpaceApple

Reputation: 1327

Converting animated .gif file into a .bmp strip

I was wondering if someone can direct me or guide me in order to use a .gif image and convert it into a .bmp strip image file.

Upvotes: 0

Views: 7043

Answers (4)

timgilan
timgilan

Reputation: 31

Making an image strip can be easily done with Photoshop (you can get a free trial version, or Elements)

  1. Open .gif - Photoshop will open each frame as a layer
  2. Resize canvas to (height of the gif * layers) pixels
  3. Remove all frame information, keep layers
  4. Select last layer, and move it to very bottom
  5. Select all layers and click 'Distribute vertical centers'. Now you have a perfectly arranged strip.

If you are using Photoshop, you can just export as BMP. Thats it.

Upvotes: 3

pannonia75
pannonia75

Reputation: 21

The method what works for sure is:

  1. Download an install Easy GIF Animator
  2. Open tour gif with it and export the frames to separate files
  3. Download and install any program which can create the layers (eg. Photoshop CS3 Little)
  4. Create a new file width as your picture; Height = Height of Your pic. X number of pictures
  5. Copy each pic. as a layers in to Your new file and move them one after the other.
  6. Save it as a .png file
  7. Download an install iPAQ 31x Image Explorer
  8. Open Your .png in it
  9. Save it as aRGB file (normal BMP may don't work)
  10. DONE!!

Maybe it's not the easiest method but it gives the possibility of precise editing and allows you to make strips of icons that are on a transparent background (but not limited to icons)

Upvotes: 2

user1306322
user1306322

Reputation: 8721

First, you need to get the gif's size. Then you need to find out how many frames there are.

After that you need to create a new image with Height = original height, and Width = Frames * Gif Width.

Then you must paste the original Gif's frames into the strip like so: Frame N starts at pixel N*Width.

That is if you're making a horizontal strip.


And here is the complete code for a console application:

using System.Drawing;
using System.Drawing.Imaging;

foreach (var arg in args)
    {
        Image gif = Image.FromFile(arg);
        FrameDimension dim = new FrameDimension(gif.FrameDimensionsList[0]);
        int frames = gif.GetFrameCount(dim);

        Bitmap resultingImage = new Bitmap(gif.Width * frames, gif.Height);

        for (int i = 0; i < frames; i++)
        {
            gif.SelectActiveFrame(dim, i);

            Rectangle destRegion = new Rectangle(gif.Width * i, 0, gif.Width, gif.Height);
            Rectangle srcRegion = new Rectangle(0, 0, gif.Width, gif.Height);

            using (Graphics grD = Graphics.FromImage(resultingImage))
            {
                grD.DrawImage(gif, destRegion, srcRegion, GraphicsUnit.Pixel);
            }
        }

        resultingImage.Save("res.png", ImageFormat.Png);
    }

The resulting image is saved in the compiled console app binary file directory under the name res.png. You can make the app save the resulting image right where the source file is, ask whether to make a horizontal or vertical strip, etc.

Upvotes: 6

Mr.V.
Mr.V.

Reputation: 128

Just load .gif in Bitmap and save it in .bmp. If you want to export the frames of .gif I have no idea how to do this. You can have look at this www.eggheadcafe.com/articles/stripimagefromanimatedgif.asp, it seems to be what what you're looking for.

Upvotes: -1

Related Questions