Revert XCode compression with pngcrush on windows?
Asked Answered
L

4

7

I have some png images extracted from IPA files and I want to get the original PNG back, I was advised that pngcush did the task required so I downloaded it and tried running the following command:

pngcrush -fix icon.png icon1.png

But I get a libpng error. I don't know if libpng needs to be downloaded as well, since the error doesn't says that I need a different version of libpng, just says:

While reading icon.png:
  pngcrush caught libpng error:
   incorrect header check

I also tried this one:

pngcrush -revert-iphone-optimizations icon.png icn1.png

And pngcrush acts as if didn't knew the command.

Any ideas on what to do?

Lagrange answered 2/4, 2012 at 1:58 Comment(2)
May you please provide a link to an "iphone-optimized" PNG so that we can test ?Accidental
On Mac if you don't want to deal with Terminal you can use iPhonePNGApp. You just provide directory of your images and it converts all png images to normal format. Very simple.Fluvial
I
3

You may be interested in this C# library I developed to reverse what pngcrush does. All existing implementations I found were either riddled with bugs or too difficult to integrate into my project so I developed this. It has unit tests if that makes you feel safer.

The -iphone addition to pngcrush was added by Apple and is only available in the version of pngcrush in the iOS SDK, accessible by using xcrun like follows:

xcrun -sdk iphoneos pngcrush -iphone|-revert-iphone-optimizations ...
Illustrative answered 24/6, 2013 at 10:1 Comment(0)
C
2

This answer: pngcrush: uncrush on linux? explains that -revert-iphone-optimizations is only present in the Apple version of pngcrush. But it does point to a couple of other options that might work. Linux, not Windows, but since there's source, you might get it to work.

Correa answered 12/4, 2012 at 12:53 Comment(4)
thanks Sparky! will give it a shot as soon as work allows... :)Lagrange
Any ideas on how to compile the sources with MingW?Lagrange
I don't have a Windows machine to try it, but try this: tar zxvf iphone-fixpng.tgz; cd iphone-fixpng; make allCorrea
I figured that out... ;) thing is, it seems it depends on several linux specific libraries...Lagrange
S
2

Maybe you can try pngdefry.

Perfect dealing pngs with multiple IDAT tags.

Suppository answered 21/8, 2012 at 2:9 Comment(1)
Seems like nice choice. It seems it's built for Linux, but I'll see if I can gcc my way on Windows. ThanksLagrange
I
0

It probably doesn't know the command. The documentation I found on -revert-iphone-optimizations comes from an apple developer page which refers to pngcrush being a part of the IOS SDK. Given that, i'd suggest it's been hacked into that specific version by apple and may not be part of the official pngcrush download. If that's true you'll actually need to install that and use the included pngcrush as explained in the article.

I'm also a bit suss on the syntax used in that example. It looks like a long option and they normally start with two hythens, not one. It could simply be a typo so try --revert-iphone-optimizations as well.

Identify answered 11/4, 2012 at 15:40 Comment(6)
sorry @SpliFF, it doesn't works out with the windows version of pngcrush, thanks for the help!Lagrange
yes, welcome to the world of apple/microsoft developer lock-in. your only real option seems to be finding someone with a mac.Identify
actually I have two Macs, but I want to work this out as a Windows app. Since iTunes had it, I thought it may happen, then again, iTunes belongs to Apple, so they may be cheating.. ;)Lagrange
the problem as I see it is that apple have created a proprietary modification of pngcrush and the PNG format for the single purpose of lock-in ( apparently the "optimisations" are actually worse than those available via existing tools - imageoptim.com/tweetbot.html ). They're not going to tell anyone what they did so only reverse-engineering is going to bring format support to other platforms. I suspect you're SOL.Identify
If that weren't bad enough ImageOptims claims that apple has patented the "optimisation" process they use. Since the format appears to be poorly optimised the only conclusion you can reach is that apple have done all this deliberately to prevent third-party iOS tools development.Identify
Following the Vendor LockIn road... I think the iTunes SDK would possibly solve this: developer.apple.com/sdk/itunescomsdk.htmlLagrange

© 2022 - 2024 — McMap. All rights reserved.