I currently have an NSData with valid PNG data:
NSData* imageData = [bitmapRep representationUsingType:NSPNGFileType properties:nil];
I've written this data out to a file:
[imageData writeToFile:@"test.png" atomically:YES];
And compressing it with OptiPNG or PNGCrush yields promising results (25%+ compression).
I'd like to perform this task in memory, adding a category to NSData to enable something like:
[imageData optimizePNGData]
However, file system calls are baked in deeply into both OptiPNG and PNGCrush, making neither of them fit to be built as a library (e.g. optipng.a).
Does anyone have any ideas of how to accomplish something similar without relying on exec calls as most of the GUI wrappers do?