Getting Around Alpha Bug for Preview in Sierra 10.12.2

I'm running into the problem accurately described here:

https://discussions.apple.com/thread/4229655?start=0&tstart=0

Summary: I take a JPG image, use a selection tool to remove the background so that it will be transparent, and then save the image as a PNG. The image background is represented as black, instead of transparent.

The link there shows that it's a "color profile" bug - is there a correct color profile that supports transparency?


Solution 1:

Even though this problem is old, I did figure out a solution that works (on Mojave at least, haven't tried it anywhere else).

  1. Find a PNG image somewhere that already has a transparent background.
  2. In Preview, remove the contents of that image and resize it to match your source image.
  3. Copy the source image and paste it onto this (now blank) PNG image.
  4. Export the image as PNG, making sure Alpha is checked. You now have an image with transparent background and your old image as a second layer.
  5. You can use the Magic Alpha on this new image and it will be saved properly.

Hope this helps anyone out there still struggling with this!

Solution 2:

It seems to depend on how the image was made in the first place, & what its current background is set to.

Testing with the example given in comments I see the same behaviour as the OP when using Preview.
Even in Photoshop the same thing happens... unless I turn the image into an unlocked layer first. After that, erasing will then erase to transparent.

I've tested with other images made in photoshop with transparency, then saved as jpg. I also checked converting the jpg to png first, before testing.
It seems Preview is not the only app which will knock out to a predetermined colour, Photoshop will do the same, unless first converted to a separate layer. [In Photoshop you get the choice of which colour, but 'transparent' isn't an option.]

I'd say therefore, it's not a bug, it's intended behaviour; a limitation of a single-layered image.

I see no way round this except to use a dedicated graphics package, like Photoshop or Gimp.