Mobile app version of vmapp.org
Login or Join
Samaraweera207

: Why does my transparent PNG not look good? I want to convert a JPG to transparent and using GIMP I added alpha layers and transparency same way I make a GIF transparent I converted it to

@Samaraweera207

Posted in: #BackgroundRemoval #Gif #Gimp #Png #Transparency

I want to convert a JPG to transparent and using GIMP I added alpha layers and transparency same way I make a GIF transparent I converted it to PNG but it doesn't display well when I load it on my template:



The original image is

Why doesn't it look good when it's made into a transparent PNG? Could I have better luck making a transparent GIF? OR is it the blue colors that don't mix well with the black and I could have more luck using some of the other logos:



Thanks

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera207

2 Comments

Sorted by latest first Latest Oldest Best

 

@Looi7658678

The main trick, in my experience, to adding smooth transparency to an image in GIMP is using the Layer → Transparency → Color to Alpha... tool. Of course, you have to know how to use it to good effect — on its own, all it does is make your images look all funny and translucent.

If I take the image you posted above, and just run Color to Alpha on it (picking white for the transparent color, of course), what I get is this:

       

As you can see, this image looks fine on a light background. Unfortunately, putting it on a dark background makes the gray elements vanish completely, and the blue parts don't look so great either:

       

The problem is that the Color to Alpha tool did what it was supposed to do: it converted all the white in the original image into transparency. This means that the gray lines became semi-transparent black lines, and the light blue became semi-transparent dark blue.

What we really want, however, is presumably that the basic colors of the text and the other elements of the logo should stay opaque, and only the anti-aliased pixels around their edges should become semi-transparent. To fix this, we need to add some white back into the colors.
One way to achieve that, for an image like this where the opaque areas consist mostly of single colors, is this:


Duplicate the layer.
On the lower layer, convert the transparency to a mask by doing Layer → Mask → Add Layer Mask... and selecting "Transfer layer's alpha channel".
After transferring the transparency to a mask, make the lower layer completely white (e.g. using the Bucket Fill tool in "Fill whole selection" mode).
You've now added some white to all the colors of the image, but the interiors of the letters and figures still aren't completely opaque. To make them so, we need to normalize the mask on the lower layer — but, since the different parts of the image have different colors and lightnesses, we need to do it separately for each part. To do that, click on the mask of the lower layer in the Layers dialog to edit it, use the Rectangle Select tool to select each distinct part of the image (the "B", the "NANO" and the drawing above them) in turn, and run Colors → Auto → Normalize on each selection.


After doing all that (and optionally merging the layers), the result should look like this:

       

If you compare this with the first image above, there's almost no difference to be seen. But see what happens when we put it on a black background:

       

Now the colors look opaque, but the background is still transparent and the edges are smooth.

Unfrotunately, you can also see some gray fringing around the letters, especially the "B". I suspect this is mostly because the original JPEG image already suffered from chroma loss in those areas due to lossy compression, it just wasn't so apparent on a white background. There are two ways (that I know of) to try to fix that: you can either manually adjust the mask color levels on the white layer to reduce the fringing, or you can try sampling the solid colors from the letters in the original image and replacing the white on the lower layer white those solid colors (Rectangle Select, Bucket Fill). Or you can even try both.

However, all this is really something you should only try if you have no other choice. A much better solution is to try and find the original vector (AI, SVG, EPS, PDF, etc.) files from which these logos were surely rendered — they should have full transparency information, be free of compression artifacts, and be scalable too! Only if it's really impossible to obtain the originals should you even consider working from low-resolution JPEG files like these.

Also, even if you do end up using the bitmaps, you could still get a much cleaner result by redrawing some of the elements — in particular the text, which seems to be simple Copperplate.

10% popularity Vote Up Vote Down


 

@Vandalay110

The problem here is that the image has a "fade-to white" at the edges, and you have not removed this. The fade or anti-aliasing is achieved using greys which become high contrast against darker colors.

I don't use GIMP, but in simple terms, the easiest way work with this is to make a new layer on the bottom of the layer stack and flood fill it with a color obvious, high contrast, and generally not in the image. I often use RGB(255,0,0). This will instantly highlight for you all the areas you need to remove or adjust to get the image to work on any background. You need to remove (not color white) the areas in the upper layers so that you see the red from the bottom layer showing through. When you are done, you remove or hide the contrast layer before exporting the PNG. This contrast layer is especially helpful because you can see the end result without needing to export it to test.

What you want to wind up with is a essentially a single layer with all the transparent portions removed (not white, but transparent). I use layer masks generally to do this, since it is non-destructive, but do whatever needs to be done.

I do think, however, that you will have better results if you reconstruct the elements instead of merely importing the JPEG. Also, the lines in this are really thin and light, and on black they might drop out.

In some cases it is better to conceive of the logo being a stamp or sticker, leave the inner bits white and stroke a 5px white line around the outer edges.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme