LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-28-2006, 05:22 PM   #1
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Rep: Reputation: 30
GIMP Capabilities


Can you use bucket fill or other method to change single color background into transparent? Example:

I have a logo on a white background. If I use "color to alpha" and make background transparent, it removes white form logo as well. I can make logo completely white and paste it first so it show through transparent logo, is there an easier way though?

Thanks
 
Old 02-28-2006, 05:37 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,770

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
From the Gimp Users Manual:
New Layer

If you right-click on a layer's bar, another menu will appear that includes a few more options than the right-click|Layers menu. Choose the first option on the list -- New Layer -- or click the left toolbar button.

When you choose New Layer, the New Layer Options dialog will appear. Name your layer in the Layer name box. For example, you could call the layer "shadow" if you are going to create a shadow of an image object in this layer. Always name your layers if you work with a lot of them, especially when you use similar layers with different functions.




If you don't want the new layer to be the same size as the background, you can specify the size of the layer by filling values into the Layer width and Layer height boxes.

You also need to decide on a Layer Fill Type. Your options are Background (the current background color in the toolbox), White, Transparent and Foreground (the current foreground color in the toolbox). White is the default fill. Click on the radio button for the fill you want and click on the OK button. Now, you have created a new layer on top of your background.
 
Old 03-02-2006, 08:33 AM   #3
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
Either I don't understand, or I just asked the wrong question. I would like to change a background color into transparent without disturbing an already existing image on it. Hopefully a better example:

I right click the "lq.org" logo at the top of the page and save it to my desktop. I open it with GIMP and remove the move background (making it transparent) without disturbing the image.

If I choose "Layer" --> "Transparency" --> "Color to Alpha" and let it remove the white background, it makes the background transparent, but it also removes the white from the penguins belly. (I am not changing logo, just example)

I was just wondering if there was an easy way to make just the background of an image like this transparent. I can easily make it black by using "bucket fill" I thought maybe there was something like this for "filling" a background or color with transparency. Thanks
 
Old 03-02-2006, 07:42 PM   #4
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
I found a "not so easy" way to get the same result, thanks.
 
Old 03-02-2006, 07:51 PM   #5
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally Posted by DrEwMoNeY
I found a "not so easy" way to get the same result, thanks.
please share it with us!!!
 
Old 03-02-2006, 09:48 PM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,770

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Had I understood the problem better first time around, I would have suggested using the selection tool to select the outline of the penguin, then invert the selection so the background is selected. Then make the selected area transparent.

I suspect that's the 'not so easy' method DrEwMoNeY discovered.
 
Old 03-02-2006, 10:32 PM   #7
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
I do apologize. If I would have realized the information may help others, I would have posted it earlier. I have enough trouble just asking a question, I know my explanations must sound like jibberish to most. I will try, though.

Bigrig's remedy normally works on some graphics, where the image you are trying to separate really stands out from its background. It worked in this case as well, but seemed to leave a lot of extra "matter" around the subject. It just didn't seem to give a real clean result. But this was just one instance. That is normally an excellent idea, that usually works.

Again, I will use the LQ logo at the top of the page, for reference. I first opened the graphics with GIMP and chose the colorize option. I made the graphic dark enough, so that it was nearly all the same color, but light enough that it contrasted with the lighter background. If you turn the saturation down, it will get rid of any funny colors later.

Next I chose the bucket fill, and made the background white. Of course with this graphic, I had to fill in the holes in the letters as well. I then used the invert option, and made the white background black, and the black (or nearly black) graphic, white.

Using the Color to Alpha option, I then removed all black from the picture (color to alpha defaults to white, I just changed it to black). Now I have an almost completely white version of the original graphic, on a transparent background.

Afterthought: [Sometimes shrinking the white layer slightly, keeps it from peeking out from underneath the color layer.]

Once again, I open the original graphic, and use Color to Alpha to remove all white from the picture. This leads me to my original problem, until, I copy this and paste it to my "all white" version from earlier, et voila! The result from this method gave me an image that looked great on most backgrounds, no matter how light or dark.

This is probably too complicated to be of any practical use, but, it solved my problem. Maybe someone could comment on how I could use less steps, or simplify it in some other way. I could post a picture and a link to it, if someone needs to see the different steps I took.

Last edited by DrEwMoNeY; 03-06-2006 at 08:00 AM.
 
Old 03-02-2006, 11:00 PM   #8
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,770

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Going back to my suggestion of making a selection and inverting it.

I understand that using the selection tool with the mouse is not exact. It isn't intended to be. It's a rough selection which must be refined.

If part of the selection line dips into the image you want to keep, zoom in on that area, press the shift key, and select the edge of the image not included in the original selection. When you release the shift key, that additional area is added to the original selection.

If the original selection includes parts of the background, zoom in on the area, press the control key and select the edge of the image to keep. When you release the control key, that part will be subtracted from the original selection.

See the Gimp Users Manual, chapter 7, Selection Control for more discussion.
 
Old 03-03-2006, 07:56 PM   #9
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
Your suggestion is good. I even mentioned it in my last post, noting that it had been tried. I just needed a method that "extracted" or "removed" the image rather then "cut out" the image. The solution I came up with is a little bit of "scratching behind your ear with your big toe" but it gave me what I needed. Thanks for the idea, though.
 
Old 03-04-2006, 11:11 AM   #10
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by DrEwMoNeY
Again, I will use the LQ logo at the top of the page, for reference.
Ok, here is something you can try. I hope you're using a current version of Gimp, but this should apply to any Gimp version.

Here is what I did to achieve most of what you're looking to do:
  1. Open the image
  2. Make a duplicate layer of the background layer. We'll use this dupe layer for our work
  3. Use the "magic wand" (Select continuous regions) tool to select the white background. It's the stick with the yellow tip (4th icon from the left in the first row).
  4. On the layers dialog, right click on the duplicate layer and click "Add layer mask". Choose "White (full opacity)" On the layers dialog, a white block should appear.
  5. Select the fill tool (the bucket) and make sure it's in "Normal" mode (which it probably will be).
  6. Click on the white background and you should see nothing happen.
  7. On the layers dialog, click the "eye" on the left of the backgroud layer thumbnail and voila, you should have a transparent background in the duplicate layer.
I can create step-by-step screenshots I can possibly attach to this post. Or I can e-mail then shots, etc.

I just did that using the LinuxQuestion.org logo you mentioned and Gimp 2.2.10.

Let me know if that works for you!

Peace...
 
Old 03-06-2006, 07:23 AM   #11
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
This is a good suggestion too. Some settings that I haven't ever messed around with. A few questions though because I think my setting might be off or different then yours.

Click on the white background and you should see nothing happen.

When I get to this step, the background actually does turn transparent. All the previous steps were followed. Maybe some of the settings for bucket fill are different. The only one I know that is the same as yours is "Normal" for mode.

Also, the holes in the letters are still white. Should I just use the same steps for each one? In all honesty the text is not as important to the image, I was just curious.

On the layers dialog, click the "eye" on the left of the backgroud layer thumbnail and voila, you should have a transparent background in the duplicate layer.

Okay, I couldn't get the last one right, maybe that is why this one doesn't seem to work for my either. Although, I do see two images in the layers dialog. One that looks like the original, and one that looks white on a back blackground. In the window with the actual image, all I see are the transparency checkers and the same dashed-outline from the original fuzzy select.

Again, maybe my settings are off, or I'm missing something. Thanks.
 
Old 03-06-2006, 07:55 AM   #12
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
Okay here is another crude method. Emphasis on crude.
  1. Remove white with "color to alpha"
  2. Make duplicate image (not layer, image)
  3. Use ink to color in belly, eyes, etc (don't go outside the lines)
  4. Paste that duplicate image you made over the top of the altered one
Most likely a painstaking process for a more complicated image, but it worked for the penguins. Again, crude, but effective. The light on the bulb is perfectly transparent, and no ring or haze around the final image.
 
Old 03-06-2006, 08:59 AM   #13
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by DrEwMoNeY
Click on the white background and you should see nothing happen.

When I get to this step, the background actually does turn transparent. All the previous steps were followed. Maybe some of the settings for bucket fill are different. The only one I know that is the same as yours is "Normal" for mode.
Ok, if you did see the background disappear, you must have hidden the bottom layer, entitled "background". See, when both layers are visible (both have "eye" icons next to them), removing the background on the top layer would cause the white background on the bottom layer to show. If the bottom layer was alread hidden (didn't have the eye next to it), then the transparency would be visible immediately.

Quote:
Originally Posted by DrEwMoNeY
Also, the holes in the letters are still white. Should I just use the same steps for each one? In all honesty the text is not as important to the image, I was just curious.
The "magic wand" tool selects continuous regions. The white in the middle of some letters isn't part of the continuous region, but could be if selected. So, you would click on the background (like you did above) and then hold the shift or ctrl key and click in the middle of the 'O' and 'e' (and so on) and those should be selected as well.

Something else, you might notice a small white border along the outside of the letters when you first apply the layer mask to make the background transparent. If you don't want this white border, when you select the background with the "magic wand", "grow" the selection by 1 pixel (I think that's in Select/Grow Selection) and that should remove the small border when you apply the layer mask. Just an fyi...

Quote:
Originally Posted by DrEwMoNeY
On the layers dialog, click the "eye" on the left of the backgroud layer thumbnail and voila, you should have a transparent background in the duplicate layer.

Okay, I couldn't get the last one right, maybe that is why this one doesn't seem to work for my either. Although, I do see two images in the layers dialog. One that looks like the original, and one that looks white on a back blackground. In the window with the actual image, all I see are the transparency checkers and the same dashed-outline from the original fuzzy select.
Ok, this means the bottom layer was already hidden. Which layers are visible or not is not critical. I just had to mention it in the event you got confused when you applied the layer mask and it didn't appear to work.

Which version of Gimp are you using? Do this, start Gimp and open an image. Then simply look at the layers dialog and you will see the layer for the image displayed with a "eye" icon on the left side. Click that "eye" to make it disappear. When the "eye" is there, the image is visible. When it is not, the image is not visible. So, if you did the work with only the top layer having the "eye" displayed, the bottom layer wasn't visible and all the other stuff I wrote above.

The above process isn't necessarily the best but seemed more simple and straight-forward than the previously posted process.

Peace...
 
Old 03-06-2006, 02:46 PM   #14
DrEwMoNeY
Member
 
Registered: Jan 2006
Location: Vulcan
Distribution: *buntu - Slackware - Anything on USB
Posts: 254

Original Poster
Rep: Reputation: 30
USER ERROR! USER ERROR! USER ERROR!

Okay, I admit it. I am an absolute boob! I need a lesson on reading directions. I was right clicking the background of the actual image and selecting "add layer mask".

For some strange reason, I thought I was accomplishing step #2 by doing step #3. If I would have done step #2 before proceeding to step #3, I would have had no problems. (In other words I thought step #3 was helping me accomplish step #2) (I promise I'm not confused any more) (I'm just confusing)

Alright, awesome directions the first time! Your expanded explanation did help me to see that the error was mine, though. And thank you for the tip on the text border. I honestly didn't know that was possible.

I am running GIMP 2.2.10. I have never messed with any of the settings, so I just assumed my setting might be different than yours.

Thank you again!
 
Old 03-06-2006, 05:06 PM   #15
tomdkat
Member
 
Registered: May 2003
Location: S.F. Bay Area
Distribution: Ubuntu 9.04 AMD64
Posts: 595

Rep: Reputation: 30
Quote:
Originally Posted by DrEwMoNeY
Alright, awesome directions the first time! Your expanded explanation did help me to see that the error was mine, though. And thank you for the tip on the text border. I honestly didn't know that was possible.
Hey, you really didn't do anything "wrong" the way you did it.

I just prefer to make changes to images in different layers, leaving the original image untouched in the bottom (background) layer. That way, if you make a mistake you simply chuck the layer in question and start over by duplicating the background layer.

The text border/selection grow thing is something I picked up when creating a Matrix wallpaper image. If you search the Gimp mailing list, you might be able to find that thread.

In any event, glad you got things working.

Now, if anyone knows how to do what he wants to do in PhotoShop, please post the info here as I'm curious to know how this would be solved in PhotoShop.

Peace...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing on HP PhotoSmart from Gimp 2.2, gimp-print drivers needed? pearman Debian 2 08-05-2005 04:19 AM
Iptables Capabilities xowl Linux - Networking 2 05-26-2005 05:07 AM
gimp / gutenprint prob: gimp does not print bitpicker Linux - Software 0 04-08-2005 07:38 AM
Can I load GIMP in english ? (only gimp) Dark Carnival Linux - Software 4 09-17-2003 05:18 PM
Kerner Capabilities gr33ndata Linux - Security 3 08-29-2003 12:59 AM


All times are GMT -5. The time now is 02:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration