Remove alpha channel in an image
The accepted answer to export to JPG, then back to PNG is not recommended.
- It's an extra step in the process (2 exports)
- JPG is lossy, so you will lose some image data
Here's a super fast and easy way to do this without the extra export or saving to (lossy) JPG:
Using Preview app (Mac):
- Open the image
- Command-Shift-S to Duplicate (creates a copy)
- Command-S to Save
- Deselect the "Alpha" checkbox
-
Delete " copy" from filename (including the space)
- This will overwrite your original, if you want to keep the original, just leave "copy" in the name
- Save
-
Click 'Replace' to confirm you want to overwrite the original
- Only necessary if you are overwriting your original
if you need remove all alpha channel from directory with icons use this command:
for i in `ls *.png`; do convert $i -background black -alpha remove -alpha off $i; done
if you have Mac OS Mojave and had "convert command not found"
brew install imagemagick
To install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Assuming you don't have another image editor, then you can open it in Preview on your Mac, and use the Export option to resave it in a different format- to ensure you get rid of the alpha channel, it might be best to export to JPG (best quality), then open that and export it as a PNG again.
Having said that, I suspect you're probably OK submitting an icon with a transparency channel as long as there's no actual transparency.