Transparency with The Gimp

Blogs

From time to time I will be adding items to these pages giving details of how to achieve certain objectives, usually related to genealogy and the use of Legacy software, often in conjunction with other software.

I am not suggesting that the solutions offered are the only, or indeed the best, options to solving problems but simply that they are ways which I have found to work.

* 'V' indicates a video is available

  1. Using Legacy Search V
  2. Search Events, Locations and Married Names V
  3. Create an Ancestry Book
  4. Map with Google Earth
  5. History of British Prime Ministers - Timeline
  6. British Civil Registration
  7. The Murder of Adam Mather
  8. Improve Photo Colour Balance
  9. Transparency with The Gimp
  10. Masking with The Gimp
  11. Web Safe Colours
  12. Create Legacy Web Pages - Part 1
  13. Create Legacy Web Pages - Part 2
  14. Create Legacy Web Pages - Part 3
  15. Using LTools Tidy Legacy HTML
  16. Insert Pictures into Web Pages
  17. Insert RSS Feed into Web Pages
  18. Getting Online
  19. Protect Your PC
  20. Open Legacy files with Open Office V
  21. FamGenContacts Database
  22. Create Direct Line Ancestor Tree
Legacy Users Subscribe to Web Users Group
Powered by
uk.groups.yahoo.com

The icons below are links to any other software mentioned.

  • Legacy
  • PSPad
  • Open Office
  • The Gimp
  • Xara 3D

Centurian

Add Transparency with The GIMP

Quite often I find that I do not have a picture of an individual suitable for use in my website but do have one where the person is part of a group. Furthermore I also feel some pictures are better presented as an ellipse rather than a rectangle. The following is a description of how to select an elliptical portion of a photograph, adjust its size and add transparency with The Gimp, using a photograph of my parent's wedding as the starting point.


Screen shot GIMP1 shows the part of the photo and The Gimp's interface. By selecting the ellipse (top row second left from the menu) an ellipse can be drawn around the portion required.

Photo

Image GIMP1

In actual fact the ellipse is not a dotted line as such but a line of "Marching Ants". Now click Edit>Copy, followed by File>New. A dialogue opens asking to confirm the page size; click "OK" and a new window will open; simply click Edit>Paste and the elliptical section will appear. To anchor the layer go to Layer>Anchor.

Ellipse Image

Image GIMP2

Naturally, the picture will not be the size required! To correct this use Layer>Scale Layer to the width or height required. If the picture was too large then it will be surrounded by a chequer board pattern (this indicates transparency) or otherwise it will be bigger than the window. No matter; in the case of the former first use the ellipse tool again to outline the center portion and then, in both cases, Edit>Copy, File>New, Edit>Paste, then Layer>Anchor. Image GIMP2 shows the result.

All that remains now is to add the transparency as the white background looks unsightly, but to do this I will be using the soldier at the top of this page in order to illustrate another point. It is, of course, possible to just change the background colour but if the image is to be used in pages with different coloured backgrounds then transparency is the way to go by using just the one image.


Looking closely at the picture of the soldier it can be seen that there is a flash of white on his helmet. As I intend to select the portion to be made transparent, by colour (in this case the white background) the helmet flash will also be selected (see Image GIMP3). This I don't want.

transparent

Image GIMP3

To overcome this, copy a section of the picture which excludes the background but includes the white flash. In this case I again used the elliptical tool to select but as it was rather fiddly, View>Zoom>x4 was used to make life easier. This selection was then copied to the clipboard.


Image GIMP4 shows the selection made. To make this image the copy was pasted into a new window but this is not needed.

comparison

Image GIMP4

Firstly it is necessary to add an Alpha Channel to the picture. Use Layer>Transparency>Add Alpha Channel. Check on the Main Menu the the boxes under "Select by Colour" are unchecked, then Select>By Colour and left click the white background and the "marching ants" will be seen around all the white portions. Finally Edit>Clear will create the transparency and the chequerboard pattern will be seen (Image GIMP 5). To fix: Layer>Anchor.

Note that, in some circumstances, when selecting by colour it may be necessary to change the threshold (on the Menu) and I have found that a setting of 5.8 is most useful for the work which I do.

transparent

Image GIMP5

All that remains now is to put the white flash back. Just paste and move to position. If it cannot be moved then click the selection rectangle and then the pasted piece and move. Click outside the position to anchor.


SAVE

Save as a ".gif" or as ".png". I prefer the former as some browsers still may have problems with the ".png" format. I also Interlace the picture when saving.

Printer friendly version Printer

Corrections, comments and suggestions are welcome, so please use the contact facility below.


The above information is given without warranty either expressed or implied

The content last updated 30 June 2010