JPEG 2000 decoding broken in 10.12.2 beta

We've noticed that since 10.12.2 beta, Apple's JPEG 2000 decoder is broken. It decodes transparent areas as a semi-transparent grey "dirt" pattern. The same images load correctly in 10.12.1 and all earlier versions. Both system apps (Finder/QuickLook, Preview) and out apps are affected.


I've already filed a Radar but I'd like a Plan B in case it doesn't get fixed. Has anyone else experienced this and maybe found a workaround using NSImage or maybe CGImage? Do I need to use some JPEG 2000 decoder library instead? Does anyone know one that's easy to integrate?

Problem still present in 10.12.2 Beta 4 (16C53a).

I wouldn't recommend using Apple's code for anything that isn't iOS-level mainstream. If PNG or JPEG break, you can reasonably expect Apple to fix it. For JPEG2000, you are on your own. I use GDAL with the OpenJPEG library for JPEG2000. If you are in a hurry and don't mind old versions, you can try the KyngChaos frameworks (http://www.kyngchaos.com/software/frameworks). Make sure to check for bundled GPL code. Personally, I prefer to build GDAL myself with my own build scripts (https://github.com/etresoft/OS-GIS). I have gotten my GDAL version working as a bundled framework in both macOS and iOS.


On a side note, GDAL is really a nice framework to use. I highly recommend it for all formats. You might be able to use OpenJPEG by itself too.


The last time I checked, Apple was using Kakadu for its JPEG2000 library. Perhaps that has changed.

This is about macOS, not iOS. Apple provides native JPEG 2000 support like it provides native PNG support. And it's broken now, so I expect Apple to fix it. We've got a workaround using OpenJPEG ready but would still prefer to use system code instead.

Problem still present in beta 5.

I realize that, but Apple is about iOS, not macOS. And Apple doesn't provide JPEG 2000 support like it provides PNG support. One gets tested on a regular basis and one doesn't. One is a priority and one isn't.


My advice is to use the beta software primaily to ensure that your software will work for your customers. You should also report any bugs you find to Apple. But don't expect them to fix it right away. Deploy that workaround before Apple releases the update. It sounds like JPEG 2000 support is important to you and your customers. When it breaks, they will complain to you. You can blame Apple, but many of them won't believe it. Ideally, your software should continue to work across updates. That may mean relying on OpenJPEG instead of system code. OpenJPEG is more under your control than system code is.


I had a very similar bug in my own software about a year ago. I was using the system XML DOM parser, which doesn't exist on iOS. My app stopped working in some cases. I noticed it during update seeding and filed a bug report. It didn't get fixed until two more releases. Luckily, it wasn't a popular app and I had few customers who noticed.


Apparently iOS also supports JPEG 2000. You might also consider writing an iOS app to reproduce the bug and report that. It might be faster to get the bug fixed on iOS and let normal upstream updates fix the macOS version.

Beta 6, the bug is still there. Apple, you're really determined to ship this, are you? What's the point in doing a beta (for a dot-release) when you don't fix the stuff that you're breaking and get reported very early on? I'm seriously frustrated, I get the impression that none of my Radars ever makes a difference. Might as well just save the time and invest it in a workaround.

Ah, I missed that 10.12.2 was released last night. With the bug. Great.

i have the same problem。。

I use the tools which write by myself to compress the img to jpeg2000. That has the alpha decode error. Maybe the lib i use is too old.

I resolve this problem by use the neweast openjpeg tools to compress. And it render ok now.

My english is poor. Sorry.

The tool download url: https://github.com/uclouvain/openjpeg/releases/tag/v2.1.2

This same bug exists in iOS 10.2. Earlier iOS do not have the bug.

JPEG 2000 decoding broken in 10.12.2 beta
 
 
Q