ios 图像不能包含 Alpha 通道或透明度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25681869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Images can't contain alpha channels or transparencies
提问by Yasika Patel
Apple has released new version of iTunes Connect & I got an error message when I tried to set Screenshots on itunes connect for my app.
Apple 发布了新版本的 iTunes Connect,当我尝试在 iTunes Connect 上为我的应用设置屏幕截图时收到一条错误消息。
"Images can't contain alpha channels or transparencies."
采纳答案by brush51
AFAIK png with transparency is not allowed. use jpg OR update your png (photoshop or whatever you using to create the png) and delete the transparency areas. if you work with shadows, use jpg, that will do no headaches.
不允许使用具有透明度的 AFAIK png。使用 jpg 或更新您的 png(photoshop 或用于创建 png 的任何工具)并删除透明区域。如果您使用阴影,请使用 jpg,这不会让人头疼。
回答by Smikey
I've found you can also just re-export the png's in Preview, but uncheck the Alpha checkbox when saving.
我发现您也可以在预览中重新导出 png,但在保存时取消选中 Alpha 复选框。
回答by Marek Manduch
it so easy...
太容易了……
Open image in Previewapp click File -> Exportand uncheck alpha
在预览应用程序中打开图像,单击文件 -> 导出并 取消选中 alpha
回答by bpolat
For this i made a new simple tool. You can remove alpha channel (transparency) of multiple .png files within seconds.
为此,我制作了一个新的简单工具。您可以在几秒钟内删除多个 .png 文件的 alpha 通道(透明度)。
You can download from here http://alphachannelremover.blogspot.com
回答by Roman B.
Use mogrify
tool from ImageMagick
package to remove alpha channel.
使用包中的mogrify
工具ImageMagick
删除 alpha 通道。
brew install imagemagick
cd folder_with_images
mogrify -alpha off */*.png
Update from May 3
5月3日更新
You can tell whether image contains alpha channel by running:
您可以通过运行来判断图像是否包含 alpha 通道:
sips -g all image.png
In case you render screenshots in iOS Simulator you can drop alpha channel by passing BOOL opaque = YES
to UIGraphicsBeginImageContextWithOptions
:
如果您在 iOS 模拟器中渲染屏幕截图,您可以通过传递BOOL opaque = YES
给alpha 通道UIGraphicsBeginImageContextWithOptions
:
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0);
回答by Seyyed Parsa Neshaei
You must remove alpha channels when uploading a photo to iTunes Connect.
将照片上传到 iTunes Connect 时,您必须删除 Alpha 通道。
You can do this by Preview, Photos App (old iPhoto), Pixelmator, Adobe Photoshop and GIMP.
您可以通过预览、照片应用程序(旧 iPhoto)、Pixelmator、Adobe Photoshop 和 GIMP 执行此操作。
Preview
预览
1- Open the photo in Preview (if the photo is in your photo album in Photos app (the old iPhoto), then simply drag it from the album to desktop. Then control-click (right-click when mouse) the duplicated photo and select Preview.appunder Open With menu).
1-在预览中打开照片(如果照片在照片应用程序(旧的iPhoto)中的相册中,然后只需将其从相册拖到桌面。然后控制单击(鼠标右键单击)复制的照片和在打开方式菜单下选择Preview.app)。
2- Select Export...under File menu, and after selecting the destination, uncheck Alphaat the bottom, and click Export.
2-在文件菜单下选择导出...,选择目的地后,取消选中底部的Alpha,然后单击导出。
Pixelmator
像素化器
1- Open the image in Pixelmator, without creating a new Pixelmator file. Just drag the photo to the Pixelmator window.
1- 在 Pixelmator 中打开图像,而不创建新的 Pixelmator 文件。只需将照片拖到 Pixelmator 窗口即可。
2- From Share menu, click Export for Web...
2- 从共享菜单中,单击导出为 Web...
3- In the top bar, deselect Transparency.
3- 在顶部栏中,取消选择透明度。
4- Click Nextand then save the new file somewhere.
4- 单击下一步,然后将新文件保存在某处。
Finally, upload the new photo to iTunes Connect.
最后,将新照片上传到 iTunes Connect。
GIMP
GIMP
1- Open the photo in GIMP.
1- 在 GIMP 中打开照片。
2- Open the Layermenu.
2- 打开图层菜单。
3- Under Transparency, click Remove Alpha Channel.
3- 在透明度下,单击删除 Alpha 通道。
4- Save the photo.
4- 保存照片。
Adobe Photoshop
Adobe Photoshop
1- Open the photo in Adobe Photoshop.
1- 在 Adobe Photoshop 中打开照片。
2- Under Layermenu, click Layer Maskand then From Transparency.
2-在“图层”菜单下,单击“图层蒙版”,然后单击“来自透明度”。
3- Delete the layer mask by right-clicking on the mask in the Layer panel and selecting Delete Layer Mask.
3- 通过右键单击图层面板中的蒙版并选择删除图层蒙版来删除图层蒙版。
回答by Hector Lopez
If you are using Photoshop go File > Save for web (Command + Option + Shift + S). Make sure the Transparency is unchecked and this should work.
如果您使用 Photoshop,请转到“文件”>“另存为网页版”(Command + Option + Shift + S)。确保透明度未选中,这应该可以工作。
回答by Kristian
Still a problem in 2019 :=)
2019 年仍然是一个问题:=)
This worked for me: Select all images you want to upload -> Right click -> Open in Preview -> Export -> Uncheck alpha -> Use the exported images.
这对我有用:选择要上传的所有图像 -> 右键单击 -> 在预览中打开 -> 导出 -> 取消选中 alpha -> 使用导出的图像。
回答by M. Junaid Salaat
Extending Roman B. answer. This is still a problem, I was uploading a cordova app. my solution using mogrify
:
扩展罗马 B. 答案。这仍然是一个问题,我正在上传一个cordova应用程序。我的解决方案使用mogrify
:
brew install imagemagick
* navigate to `platforms/ios/<your_app_name>/Images.xcassets/AppIcon.appiconset`*
mogrify -alpha off *.png
Then archived and validated successfully.
然后存档并成功验证。
回答by H6.
On Pixelmator you can use 'Share > Export for Web...' (?+ ?+ E)
在Pixelmator,您可以使用'共享>导出为Web ...'(?+ ?+ E)
and deselect Transparencyin the Tool Options Bar.
并在工具选项栏中取消选择透明度。