iospng

package module
v0.0.0-...-dccef19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2018 License: MIT Imports: 7 Imported by: 22

README

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPngHeader = errors.New("Not a Png")
	ErrImageData = errors.New("Unexpected amount of image data")
)

Functions

func PngRevertOptimization

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

old, compatible version

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.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL