David Conde
David Conde

Reputation: 4637

Revert XCode compression with pngcrush on windows?

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?

Upvotes: 7

Views: 4262

Answers (4)

Mike Weller
Mike Weller

Reputation: 45598

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 ...

Upvotes: 3

vivimice
vivimice

Reputation: 490

Maybe you can try pngdefry.

Perfect dealing pngs with multiple IDAT tags.

Upvotes: 2

Sparky
Sparky

Reputation: 8477

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.

Upvotes: 2

SpliFF
SpliFF

Reputation: 38976

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.

Upvotes: 0

Related Questions