ChatGPT解决这个技术问题 Extra ChatGPT

Images can't contain alpha channels or transparencies

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.

"Images can't contain alpha channels or transparencies." 

https://i.stack.imgur.com/D7yIp.png

That is not mentioned in iTunes Connect Developer Guide: developer.apple.com/library/ios/documentation/…
Simply convert image to JPG format worked for me!!
The very first image uploader I wrote myself could take any size jpeg, png, or gif, rotate it correctly, and output a jpeg of the desired compression level. Apparently I can make image uploaders and Apple can't. And unlike Apple I'd never dream of forcing my users to "oh, just strip alpha from the PNG manually! for every picture!".
It's lame that xcode allows this when iTunes Connect does not.

S
Smikey

I've found you can also just re-export the png's in Preview, but uncheck the Alpha checkbox when saving.

https://i.stack.imgur.com/MemhT.png


Its ridiculous that iTunes Connect won't accept screenshots generated by Xcode considering that's how they recommend you do it.
For some inexplicable reason, when I do this it cuts the dimensions in half and is now "wrong size" for iTC! WTF Apple???
It's understandable that with only $178B in cash on hand, Apple can't afford to fix this silly bug, and requires tens of thousands of developers to all tediously perform this operation themselves, over and over again. Ugh.
would that i can give this person 100 votes for solving my problem
double click photo "file" -> "Export..."
b
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.


Worked for me too.Thx
JPEG is lossy, and it's a terrible, terrible idea. Check out other answers and properly remove transparency.
Simply opening in Preview and exporting to JPEG solved the problem. XCode's device screenshot saves in PNG, which is the problem. Taking screens with the device (home button + power button) saves in JPEG.
You can export to PNG without alpha in Preview. Simply open your image, choose export, select PNG, uncheck Alpha, and click Save. Preview also support batch export if you open all your images at once.
Nice answer but as i notice .jpg result not good so i just open image in Photoshop set background layer and setting its white Color so that image transparency removed and use this image as PNG.
M
Marek Manduch

it's so easy...

Open image in Preview app click File -> Export and uncheck alpha


This will not work on Mac OS High Sierra, please try a lower version to export without alpha. Hope it helps someone.
Very easy solution. Thanks!
Works in Catalina. Replaces any transparency with white.
b
bpolat

For this i made a new simple tool. You can remove alpha channel (transparency) of multiple .png files within seconds.

https://i.stack.imgur.com/ltWmv.png

You can download from here http://alphachannelremover.blogspot.com


Thank you. I hate that Apple added yet another step to the process of capturing, saving, and sending screen shots to the iTunesConnect store.
This tool is very simple yet pretty useful. Otherwise i had to spend time with Apple's Preview App to remove transparency one by one, very time consuming. Now it is possible to make multiple files with only one shot.
Very handy, thank you! For all of the programmers Apple has, you'd think they could just strip the alpha channel automatically. I swear none of the icons I uploaded had any transparency whatsoever, yet failed submission just because they were saved in a format that allowed for transparency. sigh
You are welcome. Actually i made the program for myself as a result of frustration i had while submitting my apps to Apple then decided to share it with community here it is open source on github you can take a look the code or use how you like.
Perfect! You saved me an hour or two today. 475 images to upload due to a redesign!
R
Roman B.

Use mogrify tool from ImageMagick package to remove alpha channel.

brew install imagemagick
cd folder_with_images
mogrify -alpha off */*.png

Update from May 3

You can tell whether image contains alpha channel by running:

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:

UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0); 

The shorter output to check alpha can be achieved with command sips -g hasAlpha *.png
mogrify -alpha off 👍
g
grg

You must remove alpha channels when uploading a photo to iTunes Connect.

You can do this by Preview, Photos App (old iPhoto), Pixelmator, Adobe Photoshop and GIMP.

Preview

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.app under Open With menu). Select Export… under File menu, and after selecting the destination, uncheck Alpha at the bottom, and click Export.

Pixelmator

Open the image in Pixelmator, without creating a new Pixelmator file. Just drag the photo to the Pixelmator window. From Share menu, click Export for Web… In the top bar, deselect Transparency. Click Next and then save the new file somewhere.

Finally, upload the new photo to iTunes Connect.

GIMP

Open the photo in GIMP. Open the Layer menu. Under Transparency, click Remove Alpha Channel. Save the photo.

Adobe Photoshop

Open the photo in Adobe Photoshop. Under Layer menu, click Layer Mask and then From Transparency. Delete the layer mask by right-clicking on the mask in the Layer panel and selecting Delete Layer Mask.


This will not work on Mac OS High Sierra, please try a lower version to export without alpha. Hope it helps someone.
H
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.


Strange. This works for single image. But when I try to save actions and perform batch export - resulting images still have alpha.
K
Kristian

Still a problem in 2019 :=)

This worked for me: Select all images you want to upload -> Right click -> Open in Preview -> Export -> Uncheck alpha -> Use the exported images.


Great! Some times necessary to select more than one images, in order to right click on left sidebar images.
M
M. Junaid Salaat

Extending Roman B. answer. This is still a problem, I was uploading a cordova app. my solution using mogrify:

brew install imagemagick
* navigate to `platforms/ios/<your_app_name>/Images.xcassets/AppIcon.appiconset`*
mogrify -alpha off *.png

Then archived and validated successfully. 👍


Thanks you somuch!
b
brass

i was able to use imageoptim to remove alpha channel and compress png files.


H
H6.

On Pixelmator you can use 'Share > Export for Web...' (⇧ + ⌘ + E)

https://i.stack.imgur.com/yfLfX.png

and deselect Transparency in the Tool Options Bar.

https://i.stack.imgur.com/cyG3e.png


n
nizama bunti

i have same problem just compress your png file on https://tinypng.com/ online and then try to upload that new compressed png file.

its work for me.


This did not work for me - it still had an alpha channel
c
codehead

You can remove the alpha channel from a PNG file from the command line with pngcrush, using the flag "-c 2":

$ file input.png
input.png: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
$ pngcrush -q -c 2 input.png output.png
libpng warning: iCCP: known incorrect sRGB profile
$ file output.png
output.png: PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced

Note the change from RGBA to RGB: the Alpha channel is gone!

pngcrush lives at http://pmt.sourceforge.net/pngcrush/


R
Rahul Parikh

Faced same issue, Try using JPG format !! What worked for me here was using a jpg file instead of PNG as jpg files don't use alpha or transparency features. I did it via online image converter or you can also open the image in preview and then File->Export and uncheck alpha as option to save the image and use this image.


Does this change the quality of the photo?
M
Matthew

To get around the problem I batched converted using fireworks my png32 files to png24 for upload quick and easy. Jpeg works also but it is lossy.


A
Amit Ajmera

Faced same issue, Try using JPG format !!


4
4b0

Photoshop

Slice it Save for web Uncheck Transparency


U
Usama Ali

You can export to PNG without alpha in Preview. Simply open your image, choose export, select PNG, uncheck Alpha, and click Save. Preview also support batch export if you open all your images at once.


W
William Jockusch

If you have imagemagick installed, then you can put the following alias into your .bash_profile. It will convert every png in a directory to a jpg, which automatically removes the alpha. You can use the resulting jpg files as your screen shots.

alias pngToJpg='for i in *.png; do convert $i ${i/.png/}.jpg; done'

jpg means quality degradation, I wouldn't do that, only if I really need it to be actually smaller.
S
Som

What worked for me here was using a jpg file instead of PNG as jpg files don't use alpha or transparency features. I did it via online image converter or you can also open the image in preview and then File->Export and uncheck alpha as option to save the image and use this image.


Yes, but you're asking for trouble using jpegs. They're inherently designed for 'noisy' images like photos, but lead to artifacting on images with a lot of block colours and straight edges like screenshots.
u
user2298995

You can simply create a new Photoshop document and set its default background to White instead of Transparent. Then, copy and paste your image to the newly created document and save it.


i
invisible squirrel

Exporting from Sketch

To avoid transparency, ensure no layer extends beyond the artboard bounds.


k
kjetilh

On Windows 10 you can use Paint 3D.

Open the image Choose "Canvas" in the top menu De-select the "Transparent canvas" checkbox in the right panel Save


k
kalpeshdeo

Convert your PNG image to JPEG format.


ITunes Connect won't accept jpeg for some things. IOS App icon must be png, for example.