Incorrect image alpha rendering on Xcode 15b3 and iOS 17

I'm not sure if I'm changed an unknown-to-me setting somewhere, but since this morning, after profiling an app (metal, allocations, etc), every project I run/build on Xcode 15b3, either on simulator or on device, displays partially-alpha images blended to black, as if there was some problem in the process of compiling the PNGs (lack of premultiplying, color space, etc).

If I open those same projects on Xcode 14, they are displayed everything as they should. Also, If I open them on other computers with Xcode 15b3 other than mine, it also works fine. And it was working fine for me this morning as well, but not anymore.

I've tried uninstalling Xcode beta and the simulator a few times, cleaning folders and preferences, hoping it was some setting I changed by mistake with some hotkey, but no luck so far.

I'll attach two pictures, one from Xcode 14, and the other one from Xcode 15b3, hoping it's some silly thing I'm missing.

xc15b3:

xc14:

this issue is still occurring in xcode version 15.2 (15C500b).

Is there anyone tried to send a feedback to Apple?

I found an ugly solution to this problem, just drag image from Assets.xcassets to project。

just use UIImage(named: "btn_trend_release") works well。

but app size may increase

as LimingWan said trans png to 8 bit is fine。 simple use python fix

install PIL

pip install pillow

from PIL import Image

def deal_png_at_location(root):
    for root, dirs, files in os.walk(root):
        for file in files:
            if file.endswith(".png"):
                img_path = os.path.join(root, file)
                img = Image.open(img_path)
                # whether this file is an 8-bit png, skip it if not
                if img.mode != "P":
                    continue
                img = img.convert("RGBA")
                img.save(img_path)

deal_png_at_location("./Assets.xcassets")

I made a Proj to summarize the solution:

  • Packaged with Xcode 14.3.

    • Unrealistic. Apple required Xcode 15 now, News.
  • Move all image from assets to bundle.

    • Unrealistic.
  • Change: Assets - Image Set - Compression - Lossy, Basic.

    • Works. But the problem is that there are so many pictures that you don't know which ones are actually render wrong.
  • Change: Assets - Assets Catalog - Compression - Lossy, Basic.

    • Unavailable. Other image will render incorrectly.
  • Check image bit, if image is 4 bit or another, convert to 8 bit.

    • Works. But the problem is some 8 bit image also have wrong render.
  • Convert all images to 8 bit use PIL.

    • I choose this as the final solution.
  • Question:

    • Can we write a script to scan images that may be rendering incorrectly?

Just wondering, did Apple fix this issue in Xcode 16 beta? Has anyone sent feedback to Apple about this issue?

Incorrect image alpha rendering on Xcode 15b3 and iOS 17
 
 
Q