How to convert 10-bit HEIC image to 16-bit PNG with Image I/O on macOS?

I'm trying to convert a 10-bit HEIC image to a 16-bit PNG, but it ends up 8-bit PNG. Is there any way to force it to be 16-bit?

I'm using CGImageSourceCreateWithURL on macOS.

Though a bit late for you @sindresorhus it might still be valuable information for others to come. A workaround could be interfacing with sips via cli. You can test wether it fits your need like sips -s format png [ -s formatOptions best ] /path/to/image.heic --out "test.png".

How to convert 10-bit HEIC image to 16-bit PNG with Image I/O on macOS?
 
 
Q