This package reverts optimizations that are done by Xcode for PNG files when packaging iOS apps:
- Removes CgBI chunks
- Fixes compressed IDAT chunks
- removes alpha pre-multiply
The package does similar things like ipin.py or xcrun -sdk iphoneos pngcrush -revert-iphone-optimizations
The import path for the package is github.com/andrianbdn/iospng.
To install it, run:
go get github.com/andrianbdn/iospng
func PngRevertOptimizationWithSize(reader io.Reader, writer io.Writer) (int, int, error)This function actually does everything: reads PNG from reader and in case it is iOS-optimized, reverts optimization. Function does not change data if PNG does not have CgBI chunk.
First two return parameters (ints) are PNG width and height.
func PngRevertOptimization(reader io.Reader, writer io.Writer) errorOld-style function that does not return size also available.