Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG image I/O #645

Open
dcommander opened this issue Jan 24, 2023 · 1 comment
Open

PNG image I/O #645

dcommander opened this issue Jan 24, 2023 · 1 comment

Comments

@dcommander
Copy link
Member

It would be nice to extend cjpeg, djpeg, and the TurboJPEG image I/O functions to handle PNG images, since PNG is the standard compressed lossless image format these days, it supports 16 bits per component (and could thus be used to test the new 12-bit and 16-bit data precision features), and it isn't limited to 256 colors like GIF. We could borrow some code from mozjpeg, but significant additional development and testing would be required in order to make the PNG I/O module as feature-rich as the current PPM I/O module, which can rescale samples to the target data precision and convert between various pixel formats.

@dcommander
Copy link
Member Author

I'm refreshing my memory as to why PNG support was never added to libjpeg-turbo. It's because libjpeg-turbo and libpng are at the same level on the open source infrastructure stack. Thus, any cross-dependency between the two would have to be managed by a downstream packager in the context of a packaging environment such as a Linux/Un*x distribution, MacPorts, Homebrew, Cygwin, MSYS, Chocolatey, etc. Different Linux distributions include different versions of libpng that are not necessarily ABI-compatible, so it would probably be untenable to include a libpng dependency in our official Linux SDK packages. (It would definitely be untenable for our official macOS and Windows packages.)

That being said, libspng is a much less complex PNG implementation that doesn't depend on zlib and appears to be actively maintained. It is simple enough that we could optionally use an in-tree static implementation of it for our official packages and allow downstream packagers to link libjpeg-turbo dynamically against a system-supplied libspng implementation, if such an implementation exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant