user4822697
user4822697

Reputation:

How to make image background transparent?

I have two images:

First

http://www.eurocopter.in/contest/images/loader33.gif

Second

If you will see the first image has no background. So the background looks white. The second image has black background.

Upvotes: 6

Views: 1626

Answers (2)

Mark Setchell
Mark Setchell

Reputation: 207345

They are animated GIFs, the first with transparent background. You can separate the image into individual frames with ImageMagick (installed on most Linux distros and available for free for OSX and Linux) like this:

convert -coalesce type1.gif frame%02d.gif

which will give you the following 18 frames as individual images

frame00.gif frame04.gif frame08.gif frame12.gif frame16.gif
frame01.gif frame05.gif frame09.gif frame13.gif frame17.gif
frame02.gif frame06.gif frame10.gif frame14.gif
frame03.gif frame07.gif frame11.gif frame15.gif

frame00.gif

enter image description here

You can see them all at once if you make them into a montage like this:

convert -coalesce type1.gif miff:- | montage -tile x4 -frame 5 - montage.gif

enter image description here

You can find information about each frame, such as its size like this:

identify type1.gif

type1.gif[0] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[1] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[2] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[3] GIF 100x100 100x100+0+0 8-bit sRGB 64c 29.2KB 0.000u 0:00.000
type1.gif[4] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[5] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[6] GIF 100x100 100x100+0+0 8-bit sRGB 64c 29.2KB 0.000u 0:00.000
type1.gif[7] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[8] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[9] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[10] GIF 100x100 100x100+0+0 8-bit sRGB 64c 29.2KB 0.000u 0:00.000
type1.gif[11] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[12] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[13] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[14] GIF 100x100 100x100+0+0 8-bit sRGB 64c 29.2KB 0.000u 0:00.000
type1.gif[15] GIF 100x100 100x100+0+0 8-bit sRGB 64c 29.2KB 0.000u 0:00.000
type1.gif[16] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000
type1.gif[17] GIF 100x100 100x100+0+0 8-bit sRGB 128c 29.2KB 0.000u 0:00.000

You can put all the frames back together like this:

convert frame* -loop 0 -delay 20 anim.gif

enter image description here

You can try and remove the black background from the second one to make it more like the first one, using a command like this. You may need to fiddle with the fuzz factor a bit:

convert type2.gif -fuzz 15% -transparent black new.gif

enter image description here

Upvotes: 8

SergioPetrarca
SergioPetrarca

Reputation: 248

Yesw, you can, you have to use some sort of Photo Editing software like Photoshop, try to follow the steps in this guide, let me know how it goes.

How to Create a Transparent GIF in Photoshop

Upvotes: 2

Related Questions