View Full Version : Mentor request for gif redraw

10-13-2009, 03:53 PM
Can someone mentor me through a project, please?

I've found an animated gif that I like, but I want to use Gimp to recolour it - ideally, I'd like to effectively redraw/reconstruct it (beyond the copyright line) but when I try to use the colour menu, most of the options tell me "XXX operates only on RGB colour layers."

I tried saving the gif as a xcf in the hope that that would make the colours available, but it doesn't. I even tried painting over it, but the colours are wrong when I paint (like I choose bright red and the brush paints brown).

As you can see, I haven't a clue what I'm doing and I'd appreciate it if someone could 'teach a man to fish' on this project. Hopefully (no guarantees) I'll only need a nudge in the right direction every now and then, rather than a step-by-step tutorial, but at the moment I can't even get started.

Any volunteers?

10-13-2009, 03:57 PM
I'm game.

Did you want to do it here, or via PM/email?

-Rob A>

10-13-2009, 04:00 PM
I dunno about GIMP ...

A lot of filters only work on RGB or some specific color mode.
If you can access each frame of the GIF, you can convert to RGB and apply your filter individually.

You can then take all the frames and recompile them in to an animated GIF using one of the bazillion Gif utils out there. On recompile, the colors will be reintegrated into a new index.

10-13-2009, 05:39 PM
I dunno about GIMP ...

A lot of filters only work on RGB or some specific color mode.
If you can access each frame of the GIF, you can convert to RGB and apply your filter individually.

In GIMP, it is Image->Mode->RGB.

To change specific colours you can play with Colours->Hue Saturation or Colurs->Map->Rotate Colours

You will have to re-dither/quantify down to 256 colours again. The biggest problem with GIF animations is ensuring each frame has the same dither pattern or you will inadvertently end up with glitter.

-Rob A>

10-13-2009, 05:48 PM
You could have another quick run through my tech tut. In there it explains a little about formats. Specifically in this case all GIF type images are paletted to a maximum of 256 colours so when you have a GIF anim you can extract all the frames from it but they will all be up to 256 colours. To do special processing on images you normally need full color or true color mode which is a byte per pixel or 24 bit or 16 million colours.

You can upsample the colours in the frames from 8 to 24 bit but out of the range of possible 16 million it will still use 256 of them until you start to blur or do some processing. The issue is that once all finished you will probably want to get it back into a GIF again and then you must down sample the colours from 24 bits back 8 again.

There's not a lot of options tho. The not completely new browsers don't support animated PNG format - the MNG format which does do RGBA animations and whilst firefox, opera etc will support that as does windows picture and fax viewer, I was not sure about IE. Last time I tried it didn't but I cant see why it should not now.

Incidentally ImageMagick will generate MNG files from a series of PNGs if you want to try.

10-13-2009, 06:27 PM
If you use one of those gif compilers, you don't have to worry about the index color. They take care of that for you.

10-13-2009, 06:33 PM
I dunno if this is gonna work but here is a gif next to an mng so whether any of us will be able to see it will be interesting. I am not getting life out of firefox or IE or windows pic viewer but (as usual) irfan view is alright with them.

1st: GIF

2nd: MNG

Right, lets see what this does. I expect we will see the gif only...

Links to files:

10-13-2009, 06:36 PM
Yeh, I only see the GIF. I'm on Firefox 3.5.3.

I'd never heard of the MNG. I was just checking out its site. Cool! About time for a multibit-alpha animated format. It's like Ping and Gif had a love child ... Piff.

10-13-2009, 06:44 PM
Yeah, unfortunately its been about for a while and its not really took off well. I think with the full color pixels then there is very little match between similar but not exactly the same frames so it practically has to encode them all as full PNGs. This is unlike say MJPEG which compresses across the series in time as well as X-Y and because JPG is lossy then it can munge it in 3 dimensions and compresses it a lot better. Still, it looks like Opera also does not see it so I think all three big gun browsers on windows at least cant do it. God help up if Safari see it fine - we'll never hear the end of it... :) So yeah its potentially cool but in reality its not gonna happen. Shame cos I could point out the great quality difference between the two anims. And you can have faded transparency on MNG too unlike gif.

10-14-2009, 03:48 AM
I tried with Safari 4.0.3 for Windows.


Steel General
10-14-2009, 06:20 AM
After a quick bit of Google-Fu I found this (http://labs.mozilla.com/blog/2007/08/better-animations-in-firefox-3/) regarding Firefox and animated images. Looks like it supports .APNG (which I had never heard of).

10-14-2009, 06:57 AM
Wow. Great response, thanks guys.
I think if we do it here it might help another noob in the future.

I'm getting to grips with some of the Gimp functions - my copy has a gif converter, so that should take care of colour conversions, and this image has only very basic colours anyway.

Image->Mode->RGB. That's what I needed to start with, thanks. (I think. I'll check it out later). Once I can access the colour tools, I'll probably muddle through, though to save me some time and experimentation, my next question will be:

Is it possible to change a range of colours (eg several shades of blue into several shades of red) simultaneously, or will I need to pick out and convert each shade individually? I did manage to adjust the colour selector slider to pick out all the blues in one go, but since I couldn't access the colour changing tools I couldn't experiment with changing them to a similar range of reds.

Here's a link to the little gif I'm playing with.


Maybe it's one of yours? Just look on this as sincerest flattery. ;)

Gimp gives me access to the individual frames of the sequence, and I want to play with changing the colours to get a feel for how the flag is painted. Eventually, when I've figured out exactly how it's done, I want to use this image as a model to create my own copright-free flag-waving smiley and produce it with a range of different flags.

The smiley is simple, even I can draw one of those from scratch, but that fluttering flag is not so easy. I'm thinking that if I want to produce a range of these, the best thing would be to create the fluttering and shadowplay separately (is that what's called a mask?) and see if I can use flat colours for the different flag designs. I think that's going a step beyond the original and might be beyond my skills, but if you don't try...
I couldn't do gifs at all until last week. :)

10-14-2009, 08:25 AM
I did a fluttering flag once and its not all that hard to do but you need to do that in a 3D program like blender (or something simpler). In that case you just texture map the flat flag onto the flag and make the geometry in the flag ripple. Then render all the frames out. Its then no problem to substitute the flag and do again and again.

You could do the substitution onto the gif anim by hand I guess but I think thats a lot of work if doing more than one.

In PSP there is a dialog widget thing where you tell it a range of color shades to translate to another set. In image magick you can do same with a color lookup table. Don't know about gimp tho.

Edit - I still have it...

10-14-2009, 09:40 AM
I had a Gif util once that would let you adjust the color table as a whole, in much the way that you can adjust HSB or RGB images. I'm sure some Gif utils still have such a thing.

10-14-2009, 12:28 PM
In PSP there is a dialog widget thing where you tell it a range of color shades to translate to another set. In image magick you can do same with a color lookup table. Don't know about gimp tho.

In Gimp it is he colour map rotate. But it only works on RGB images Alternately, you can jsut select the flag area and just use the hue slider in the HSV adjustment dialog *picking the last used setting from the preset drop menu) on each layer, then convert back to indexed.

Here is an example of that workflow on your flag:

-Rob A>

10-14-2009, 01:03 PM
Sorry, I answered my own question before logging on again. Yes, I found you can change all the shades of blue by moving the slider on Hue.

3D programs are something I really don't have time to learn. Learning gif animation is bad enough.

Ok, here's what I've made. Note this is a 1st attempt WIP.

I drew a smiley with a rectangular flag from scratch, so this one is all my own work, then I copied the layer, selected the flag and ran Filters->Distorts->Curve Bend. I then followed it with a few strokes of Burn.

This repeated 7 times with different curves, for an 8 frame gif.

The resulting gif is shown here.

However, I seem to have hit a problem. Despite copying the original layer each time (with the rectangular flag, not copying the last distorted copy), the distort seems to carry forward from one copy to the next, making the flag more and more of a mess in successive frames, and I can't figure how to erase pixels to transparent in order to touch in the messy bits.

When I choose eraser and click on pixels, nothing happens, though I can use pencil and alter pixel colours to anything other than transparent.


Why can't I erase pixels?
Why does the distort carry over to successive frames, and how do I prevent it?
Is there a way to do the curve distort on the horizontal axis as well as vertical?
Any feedback on the WIP greatly appreciated


10-14-2009, 02:32 PM
Change your Frame Disposal (in the gif file save dialog) to "One Frame per Layer (Replace)"

-Rob A>

10-14-2009, 05:41 PM
Konqueror is supposed to support mngs, but it doesn't seem to be working in the windows KDE4 port... I'll try the 'nix box really quick.

Edit: yeah no luck there either.

10-15-2009, 03:26 AM
Change your Frame Disposal (in the gif file save dialog) to "One Frame per Layer (Replace)"

-Rob A>

Doh! Yes, if it's seeing through all layers that'll explain the mess and the inability to erase - I'd have to erase each pixel 8 times to drill down to transparent.

Thanks Rob, I missed that prompt, otherwise I would have used it.

I think Redrobes' 3D version is the only one that would allow an instant flag change. I can't see any way in Gimp to replace the flag pattern without completely recreating the gif. (other than recolouring similar patterns) However, I've got it down to about 2 mins per layer now, so I can build up a new flag in around a quarter hour, (excluding pattern creation) which isn't too bad if I only need a couple. I wouldn't want to do a 'flags of the world' range that way, though.

Ok, here's the re-saved version, let's see what this turns out like.

Edit: Hmm, there's still a problem on the top edge, though the bottom edge seems to be sorted now. I wonder if the flag's too close to the top of the bitmap? Or maybe the selection area for the distort didn't completely enclose the flag border?
<Groan> sounds like another redraw...

10-15-2009, 04:35 AM
Right, here goes, I've redrawn it (again) moving the flag down a little and selecting an overlarge area for the flag, and I've also taken the trouble to map out the sine wave flow, (sequential directions on the curve bend) so the ripples should be smoother.

Edit: Nope, there's still a problem - notably on the bottom edge again now. I really dunno what I'm doing wrong. I did the 'Replace' thing, but it looks like it's still seeing more than one layer at a time. Unfortunately, I can't play it clearly anywhere other than here. It doesn't show up clearly on Gimp's replay. At least the ripple is smoothed out now. I'll poke about with it some more. :(

10-15-2009, 05:05 AM
This is a trial after using the eraser on the gif frames to clean up the bits that shouldn't be there:

Edit: And finally it looks right. (to my non-artistic eye) :)

What do you think? Job done, or more work needed?

10-15-2009, 07:53 AM
I think that looks good.

10-16-2009, 05:52 AM
Ok guys, I'm happy with it anyhow.
A few weeks ago I couldn't have attempted anything like this. Just being here on CG has given me the inspiration and confidence to try out things like this, and with your help I've got there.
Thanks again for the advice. :)

10-16-2009, 11:27 AM
Ok guys, I'm happy with it anyhow.
A few weeks ago I couldn't have attempted anything like this. Just being here on CG has given me the inspiration and confidence to try out things like this, and with your help I've got there.
Thanks again for the advice. :)

See - Gimp didn't turn out to be so bad... IIR you were fairly resistant in the beginning...

-Rob A>

10-17-2009, 03:54 AM
Yeah, Gimp's ok. :)

Some complex software is capable of doing all sorts of complex stuff, but you need to learn complex instructions even to make it do simple stuff.

Other software is capable of doing complex stuff with complex instructions but can also do simple stuff with only a slight knowledge.

Gimp seems largely to fall into the latter category, though there are still some things I'd rather use MSPaint for - simply because Paint does the same thing with even less complex commands.

For example, I created the smiley and flag outlines in Greenfish Icon Editor, because drawing circles and lines is so ridiculously over-complex in Gimp. It's much quicker and easier to create in GIE and import the png into Gimp for animation and conversion to gif. Paint won't handle transparency, so that would have meant another step.

My initial resistance to Gimp was down to rumours of its complexity.
Maybe the initial slopes are shallow and the big learning curve is yet to be discovered...?

10-17-2009, 10:47 AM
Rather than "complex," I'd say "deep." There's an awful lot that Gimp is capable of, and to become a virtuoso with a program like that takes a lot of time and effort. However, to do the sorts of things you're starting out with, you don't need to know most of that. If you're content with taking things slowly, the learning curve doesn't necessarily have to be steep.

But when you decide you want to move on and learn a bit more about it, the rest of that functionality will be waiting for you. How fast or slow you learn it is totally up to you.

10-18-2009, 03:30 AM
Yeah, I'm comfortable learning a bit at a time, fitting it around other commitments. I'm reasonably happy with both Gimp and Inkscape in that respect. My gripe is with software where you have to learn everything to do anything.

Just going back to the flags again...

I've done another, and I'm still finding a consistent problem with the final gif apparently showing multiple layers simultaneously. I can now clean it up by using the eraser on each frame, but it's a PITA and I'm not sure why I need to. I can't figure why it's not replacing each frame with the next as I instructed it to do in the gif conversion sequence (as RobA suggested). (or rather, it is replacing them, but each frame seems to retain a remnant of underlying frames). Any ideas? Is there something else I'm missing?

My best guess is that when I do the distort on the duplicated layer, it's overlaying the distort on top of the duplicate background instead of replacing the background flag with the distorted one, but if that's it, I can't figure why.

10-18-2009, 09:32 AM
Personally I think your best off getting all the frames out as individual images and then modifying them there and putting them all back together as the animation at the end. The collating frames bit of software should then do all the work for you to get the right frame to frame transition effect right.

Just to say that if you had "frame1.png", "frame2.png", "frame3.png" etc then in image magick it would be "convert frame*.png anim.gif" and it ought to do it all for you. Theres a few more optional params you can add to juice it up some more but you don't strictly need them.

10-19-2009, 12:05 PM
I know you are having fun with this, but (for what it is worth) there is an animated flag script available for Gimp:


And the result:


adding in the smiley on each layer should be the easy part now..

-Rob A>

10-20-2009, 04:59 AM
Doh! Now he tells me. ;)

No seriously, as you say, the flag is just an incidental topic, it's the animation techniques that are interesting me at present, and I'll never cope with scripting, so going that route, although it provides a neat finished product, won't teach me anything.

Nice effect though, I'll remember that if I need a bigger, better flag sometime. My little thing with its botched burn might be ok for a 40x40 icon, but it would look pretty awful on a bigger image.

Cheers. :)