13

I’ve had this happen with more than one image lately.

I open an image in GIMP with the purpose of making the background transparent. The first thing I do is Add Alpha Channel. I proceed to remove the background. Once I’m done with that, I export as PNG. But the background isn’t transparent. I can’t figure out for the life of me why that is. I’ve never had this problem before. The image is in RGB mode. I’m using GIMP 2.8.10. Is there some obvious step I’m missing?

7
  • Well at least with photoshop, beginners often forget to remove or hide the white background layer before saving.
    – Joonas
    Sep 23, 2014 at 5:16
  • 3
    Do you confirm you see the grey checkered pattern in the areas that should be transparent prior to exporting?
    – jsbueno
    Sep 23, 2014 at 14:51
  • 1
    It might help if you could post some "before / after" images demonstrating the effect (and, if possible, a third image demonstrating the outcome you actually want). If the image looks OK in GIMP before you export it, a screenshot might also help. Sep 23, 2014 at 18:59
  • If layer masks are involved, then the OP might have been exporting the mask instead of the actual image. But given there was no step by step description of how to reproduce the issue, we will never know... Mar 19, 2018 at 21:19
  • I found a bug: To reproduce: Open png without transparency, add alpha channel, add transparent content, export PNG, new file doesn't have transparency. Workaround: add alpha channel, save as XCF, close GIMP, reopen XCF, export as PNG.
    – Rodney
    Jan 7, 2019 at 13:10

4 Answers 4

13

I’ve worked out why this might happen. If the Image Mode is set to Indexed Color, then the export doesn’t seem to accept the added alpha channel. So:

  1. Image → Mode → RGB

  2. File → Export As → imagename.png

This should now export the image with the alpha channel, and transparency.

5
  • 1
    In indexed mode the alpha-channel is binary (fully opaque or fully transparent), since this what the GIF format supports.
    – xenoid
    Jun 7, 2017 at 9:43
  • So the alpha channel would be exported OK with "indexed" mode, if exporting as "gif", but seems to be discarded in "indexed" mode when exporting as "png". Not sure if that's a GIMP bug? Or maybe some user feedback would be helpful (like a warning about losing the "binary" alpha channel when exporting to "png")... Jun 7, 2017 at 13:36
  • Can't tell without checking with the OP's XCF.
    – xenoid
    Jun 7, 2017 at 13:57
  • This fixed it for me, and with your information explains why. I don't see any reason to assume the OP had a different problem that had identical symptoms :) Jun 8, 2017 at 7:09
  • My problem was the reverse, I wanted the non-transparent background. I shifted to RGB and that fixed my problem.
    – Thom
    Dec 17, 2018 at 20:28
2

In case you also want to have the background transparent you will have to tell Gimp which color this is.

Therefore in addition to adding an alpha channel we will also have to convert the background layer color to transparent. If no alpha channel was defined choosing Layer > Transparency > Color to Alpha... will automatically add an alpha channel with the color chosen to be transparent.

Note that this will also introduce semi-transparency in the foreground if we had not defined the background as a separate layer, which is proabably not what we wanted.

In this case to leave the foreground opaque and to only make the background transparent we have to select all the background areas (using the wand tool or the select by color tool). We can then remove the background to transparency by selecting Edit > Clear or pressing Del.

1
  • 1
    I... rather doubt that's the issue. The OP says they "remove the background" after adding the alpha channel, and however they're doing it, it does sound like they know how to do that. That said, there's not enough information in th question to really diagnose the issue, so I can't completely rule out the possibility that you might be right after all. Sep 23, 2014 at 19:01
0

There maybe one simple step you're missing, I actually did! When you export the file as a .png file, you also have a dialog box that pops up. Is the 'Save Background Color' option checked? If it is, then this is the problem!

1
  • For the records: no, this isn't the problem, all this does is set a specific chunk of the PNG file to indicate a background color for PNG renders which don't support transparency at all. Jan 14, 2020 at 16:56
0

So you opened an image on GIMP and proceeded to remove background from the image.

Are these the steps you followed for the start of removing background from image:

  1. Layer
  2. Transparency
  3. Add Alpha Channel

What is your next steps of following to remove the background?

Also after officially removing the background did you:

  1. File
  2. Export As
  3. rename to image.png ?
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.