JPEG 2000 premultiplied alpha?

I have a workflow that takes PSDs and exports JPEG 2000 files. I notice that it seems as if Retrobatch is premultiplying the alpha (I think that’s the term), because the resulting JPEG gets grey in the transparent area.

Example of the resulting JPEG2K, each with a colored background added so the issue is more apparent.

Any idea how to make this go away?

@jmck I just tried it out on my end, and the transparent areas showed up correctly. However- if you use QuickLook to preview a jp2 file in the Finder, it’ll draw over a gray background. Preview does the same thing. Maybe that’s what you are seeing?

Or are you opening them up in an image editor and getting a gray background where there should be a checkerboard background?

The image looks incorrect in Preview, in comparison to how the same file renders out in PNG format. In the above example I opened it back up in Photoshop and put a colored background behind it to make it more obvious. For reference, the image data remains colored similar to what you can see in the screengrab — white background. So I would expect to see white gradating into the coral background above, but instead I see grey creeping in along with the transparency.

Below is the same image rendered as a PNG, then reopened in Photoshop so I could add the same coral background behind it.

@jmck Can you send me a sample PSD file? (support@flyingmeat.com).

So it looks like the system image libraries are really messing things up and not handling alpha correctly at all on 10.15 for PSD files. I swear it wasn’t like this in previous OS releases.

I’ll have to file a radar on this or find some interesting workaround. It does look like premultiplication is getting in the way, big time- but I’m not able to undo it because the transparent areas, which are black technically, are getting baked into the image.

One thing you can do though, is use the latest build of Retrobatch which actually has an unpremultiply node in it. If you use it twice in a row (ie- have two nodes of it), it will clean up the gray, but kind of wash out the transparent areas a little bit. It’ll also get rid of the drop shadow unfortunately.

http://flyingmeat.com/download/latest/#retrobatch

What I’ll need to do to fix this is write my own composite reader for the PSD images, but that’s not something I can just whip up. I will look into it though.

-gus

Thanks for looking into this. After a quick test it looks like TIFF transparency is not affected by this bug, and for my purposes it’s not a big hardship to feed these to Retrobatch instead, although PSDs would be preferred. But I’m good for now!