Remove alpha channel in an image

前端 未结 13 1176
青春惊慌失措
青春惊慌失措 2020-12-12 15:10

I have an app icon for iOS but Apple doesn\'t allow alpha to be in the image. How to remove this alpha channel? I only have the png image with me I don\'t have the source fi

相关标签:
13条回答
  • 2020-12-12 15:48

    You can try imagemagick (also easily resize for different sizes):

    convert in.png -background black -alpha remove -alpha off -resize 1024x1024 out.png
    
    0 讨论(0)
  • 2020-12-12 15:51

    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.

    0 讨论(0)
  • 2020-12-12 15:51

    Just got the the following error when trying to upload my app to the iTunes app store:

    iTunes Store Operations Failed

    ERROR ITMS-90717: "Invalid App Store Icon. The App Store icon in the asset catalog in 'MyApp.app' can't be transparent nor contain an alpha channel."

    I confirmed that my app store icons did include the alpha channel by locating the asset in Finder and looking up its info (⌘+i). Underneath More info, it showed:

    Alpha channel: Yes

    Found the solution above to use Preview to remove the alpha channel by exporting it with the Alpha checkbox unchecked, but figured a way to batch export them since I had 18 assets I needed to strip the alpha channel from.

    The way I got batch exporting to work was to select all my app icon assets in finder > right click > open (or open with preview)

    All of the assets will now appear in the same window. Select all (⌘+a), and then select File > Export Selected Images… > Expand Options > uncheck the Alpha checkbox > Choose (your destination folder)

    Done! All your images are now exported with the alpha channel stripped off.

    0 讨论(0)
  • 2020-12-12 15:55

    I had this same issue, but the other answers didn't work for me now (it may be an Apple bug). I figured out that you can use this website to remove the alpha channel from an image.

    0 讨论(0)
  • 2020-12-12 15:56

    To remove alpha channel from png:

    on Mac: Preview version 9.0 (macOS Sierra) can remove the alpha channel if you export or save the image.

    Preview version 10.0 (944.2) (macOS High Sierra) does not remove the alpha channel. Both Export and/or Save does not remove the alpha channel from the image.

    0 讨论(0)
  • 2020-12-12 15:57

    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
    
    0 讨论(0)
提交回复
热议问题