AndrianBdn / iospng

Revert iPhone PNG Optimizations in pure go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS PNG File Normalizer

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

Installation

The import path for the package is github.com/andrianbdn/iospng.

To install it, run:

go get github.com/andrianbdn/iospng

Usage

func PngRevertOptimizationWithSize

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

func PngRevertOptimization(reader io.Reader, writer io.Writer) error

Old-style function that does not return size also available.

See also

About

Revert iPhone PNG Optimizations in pure go

License:MIT License


Languages

Language:Go 100.0%