It is currently Fri Apr 19, 2024 11:26 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sat May 15, 2010 5:04 pm  (#1) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
When you are working with .gif images you need to know about semi-transparency and antialiasing and how they behave in .gif images. GIF format is the main file format for making animations for the present and success at making transparent gif and animated images that look good depends upon knowing about semi-transparent pixels, antialiasing, and semi-flattening.

GIF files can not handle semi-transparency therefore those pixels need to be completely filled with color.

This picture is a demo of semi-transparency. I put the red dot to demonstrate the shading. That shadow is not fading from black to gray. Every pixel has gradations of black that get less and less as the shadow gets lighter and lighter. Imagine teeny dots of black in each pixel becoming less and less dense. GIF images can't handle that. The pixel has to be made opaque by adding background color behind those dots. The process of adding the background color is called, semi-flattening.

Image

This is what it looks like in GIMP after it's been semi-flattened.

Image

When you create text or draw you get something called antialiasing. That is the addition of semitransparent pixels around the image. It gives a smooth look to the image. If you don't semi-flatten it, .gif image format deletes those antialiased pixels and you get a rough, not so nice finish.

These two smilies demonstrate that. The one on the left is semi-flattened, the one on the right isn't and looks rough - the bigger the image, the rougher it looks. It's pretty apparent that you need to semi-flatten .gif images.

Image

This is the red smiley zoomed and you can see the lighter pixels around it. That is the antialiasing.

Image

Here is a text example.

Image

The two goblets in this picture started out with identical drop shadows. The one on the left was semi-flattened, the one on the right wasn't. As you can see, the gif format ate the antialiased pixels and the semi-transparent parts of the drop shadow. All that's left of the drop shadow are a few black pixels on the right and bottom of the goblet.

Image

You can see what happened to the drop shadow on these hearts.

Image

How to semi-flatten your image.

You can get fencepost's Settings with Semi-Flatten script here. Right-click and download it and save it in your /.gimp-2.6/scripts folder. It will save you a lot of time.

You can also access semi-flatten and do the layers one at a time by Layer > Transparency > Semi-Flatten.

This is an image of the Settings with Semi-Flatten script dialog. Make the color the color of the background you will be showing your image on.

You will find it in Filters > Animation > Settings with Semi-Flatten.

Image

You can do it manually by going to Layer > Transparency > Semi-Flatten or to Filters > Web > Semi-Flatten.

PNG images don't need semi-flattening and will look nice because they can handle semi-transparency. PNG animations are starting to be showing up on the web now but are few and far between so far.

Optimizing the Difference
Optimize the difference after semi-flattening.

If you have a large animated image with many layers, you may want to cut down on bandwidth size by optimizing the difference. Before semi-flattening, save your image as a GIMP .xcf file so if you need to edit it again you will have a complete copy. After optimizing the difference you may not be able to edit it effectively. Press Ctrl + D, close the .xcf file and you will have a copy of it. Always work on copies; preserve your original file.


After you have semi-flattened the layers, go to Filters/Animation/Optimize (Difference). Wait until it is finished. The layers should have (combine) in them after the speed rate.

Image

Then Save As an animation. When it comes to frame disposal, click the down arrow by frame disposal and choose Cumulative layers (Combine)

Image

Optimizing the difference removes repeated areas of the file. If you have a picture behind the animation layers, it will only be visible in the first layer of an optimized, combined animation.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sat May 15, 2010 5:30 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Apr 30, 2010
Posts: 1937
Location: Missouri
This looks like it's written for GAP? Usually any animations I do are with Xara Extreme but I've been wanting to install but haven't figured it out yet. I saved this nevertheless.

_________________
Image
The last time I kept an open mind,
my brain fell out and the dog grabbed it.
Now it's full of dirt, toothmarks, and dog slobber.
No more open minds or dogs for me.


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sat May 15, 2010 6:37 pm  (#3) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Not just for GAP.

I think Xara Extreme probably has a semi-flattening choice when you save your animations from there.

That's not to say GAP animations shouldn't be semi-flattened. All gif images that have any transparency in them should be semi-flattened whether they are animations or not.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sat May 15, 2010 7:10 pm  (#4) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
To add to what O said; remember that each layer in a GIMP image can also be treated as a frame in an animation. You can just save the layers as an animated .gif or .png (with the apng plugin).

Basically, GIMP has built-in framework to handle animations, even without the GAP plug-in.

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sun May 16, 2010 2:35 pm  (#5) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Gms9810 wrote:
This looks like it's written for GAP? Usually any animations I do are with Xara Extreme but I've been wanting to install but haven't figured it out yet. I saved this nevertheless.
I think I recall you mentioning that you are a PaintShopPro user. I, too, have come from PSP7 and I used Animation Shop with it to create animations.

Not so with GIMP. As GnuTux said, gimp can make animations simply with layers. The layers make the animation frames and when you save it as a gif you check Save as Animation in the dialog.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sun May 16, 2010 8:20 pm  (#6) 
Offline
GimpChat Member

Joined: Apr 14, 2010
Posts: 34
This is very informative and interesting. I know I find it very useful. Thanks for posting. :tyspin

_________________
Image


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Sun May 16, 2010 9:01 pm  (#7) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I'm pleased it was useful for you, Silvertayl. Keep on GIMPing! :paint

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 5:47 pm  (#8) 
Offline
GimpChat Member

Joined: Feb 06, 2011
Posts: 342
Sorry been working on other projects, but from time to time I come here to read stuff. :)The reason why I ended up on this very old post. LOL I have textures that contain several layers I place on 3D meshes or objects and was wondering if this technique would help make the details look better? Also with brushes too because it seems if i go too small or too large to make them fit properly I lose the detail and crispness. I will try to post some pictures of my work. :) Thanks.. :paint

Liana


Attachments:
File comment: opacity map of an item I was working on. Lines are blurry.
enya bodysuit opacV1.png
enya bodysuit opacV1.png [ 9.97 KiB | Viewed 25922 times ]
File comment: I created the design using the paths tool.
patternfablereddress.jpg
patternfablereddress.jpg [ 17.3 KiB | Viewed 25922 times ]
Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 6:02 pm  (#9) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
I only recommend semiflattening for transparent backgrounds in gif images.

I downloaded your white bikini and played with it a bit.

Use the Color Selection :colsel tool with the threshold set at 30 and click a white area. All of the white will be selected. With the selection in place, Select > To Path.

Ctrl + Shift + A to turn off selection.

Make a new layer filled with black, then Select > From Path and fill the selection with white. The Paths tool is great for smoothing out stuff like that. Here's what I got when I did that. Yours in on the left, the one I did on the right.

Image

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 7:06 pm  (#10) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Thanks O, for educating us a little bit more. I had no idea about semi-flattening with .gifs (evidence that I am not a big animation artist) but I did make some emoticons for messenger and struggled with the apparent pixelation. Now I know what I need to do to fix that. Thanks.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 8:01 pm  (#11) 
Offline
GimpChat Member

Joined: Feb 06, 2011
Posts: 342
Oh great thanks O. :) I will do that with my other things I make from now on. I posted my finished colored project on the 3D mesh and avatar. I have not done any meshing just the retexturing. I did the textures on everything but the skin color, head, and eyes. No I do not look like that. LOL Thanks again for the info.

Liana


Attachments:
File comment: My friend wanted me to make her a bikini with loin cloth. Native style she is part cherokee. LOL
black wolf loin cloth pic.png
black wolf loin cloth pic.png [ 23.31 KiB | Viewed 2101 times ]
File comment: Fur and deer skin. :)
fur n deerskin bikini pic.png
fur n deerskin bikini pic.png [ 24.27 KiB | Viewed 2101 times ]
Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 8:20 pm  (#12) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
mahvin wrote:
Thanks O, for educating us a little bit more. I had no idea about semi-flattening with .gifs (evidence that I am not a big animation artist) but I did make some emoticons for messenger and struggled with the apparent pixelation. Now I know what I need to do to fix that. Thanks.


Well great, Mahvin. Glad you found it helpful. This tutorial kind of got resurrected. It was posted last May and is having a second life. :gimp

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
 Post subject: Re: GIF: Semi-transparency, Antialiasing, Semi-Flattening
PostPosted: Tue Mar 15, 2011 8:23 pm  (#13) 
Offline
Retired Staff
User avatar

Joined: May 22, 2008
Posts: 6947
Location: Somewhere in GIMP
Lianam wrote:
Oh great thanks O. :) I will do that with my other things I make from now on. I posted my finished colored project on the 3D mesh and avatar. I have not done any meshing just the retexturing. I did the textures on everything but the skin color, head, and eyes. No I do not look like that. LOL Thanks again for the info.

Liana

Liana, those are adorable. Keep up the good work.

_________________
Image
World War IV will be fought with sticks and stones. - Albert Einstein


Top
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Adding a image as a layer, moving layer, and then flattening

2

No new posts Attachment(s) Transparency not working on a PNG generated by PowerPoint

5

No new posts Attachment(s) exporting 256-color indexed png & gif missing transparency

9

No new posts New GEGL filter that inverts transparency and allows a color fill

2

No new posts Selection pasting only transparency - single layer image [Solved]

3



* Login  



Powered by phpBB3 © phpBB Group