pngcrush: uncrush on linux? [closed]
Asked Answered
C

2

4

Apple's iOS SDK use a modified version of pngcrush for converting png files in iOS bundles. Their version can also revert the changes (using the "-revert-iphone-optimizations" switch), but the original version can't.

Is there a tool that can be run on Linux and revert the iphone optimizations?

Thanks.

Cozza answered 21/8, 2011 at 14:1 Comment(0)
I
3

iphone-fixpng works in Linux. See this discussion explaining what it does. I'm linking to web.archive.org because the original is down.

Inna answered 21/8, 2011 at 19:4 Comment(4)
Please read the question. pngcruch binary that is provided with iOS sdk includes Apple's code that is not available in original version of pngcrush. It should be on apple.com/opensource, but sadly it's not.Featheredge
Guilty as charged. I rewrote my answer.Inna
Thanks. Actually, the discussion you linked to had a link to something even better (for my needs) - a Python based "iPhone PNG Images Normalizer" - axelbrz.com.ar/?mod=iphone-png-images-normalizer.Cozza
Hi does anyone have an updated link where to find the iphone-fixpng app?Subway
C
3

You can choose to use one of this:

  1. Install Hackintosh inside linux, with VirtualBox. install Xcode inside it, then do something like this

    $ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -dir uncrushed -revert-iphone-optimizations -q *.png
    

    This uses a modified pngcrush from apple to undo its optimizations. Guess this will work with all crushed pngs. See this for more accurated command xcrun

  2. Download iPIN.py from this blog and execute as

    $ python ipin.py
    

    This will uncrush all files from actual directory and its subdirectories. Don't worry about call it twice, from my experience does not corrupt already uncrushed pngs. From here you will find that ipin.py does not deoptimize all apple pngs

    It (ipin.py) cannot handle multiple IDAT chunks, does not work with Adam7 interlaced images, and does not fix pre-multiplied alpha.

  3. Use an specific gnome binary tool. This needs a few low level steps:

    $ git clone https://github.com/hadess/fixpng-thumbnailer.git
    $ cd fixpng-thumbnailer
    $ ./autogen.sh
    $ make
    $ sudo make install
    

    After that, you have available a new command gnome-fixpng-thumbnailer which works like this

    $ gnome-fixpng-thumbnailer [INPUT FILE] [OUTPUT FILE]

    Take care with this command, because it corrupts pngs if is called twice on same png.

    I use it this way:

    $ for file in *.png; do echo "   $file";gnome-fixpng-thumbnailer $file $file; done
    

    You will guess why echoed the filename. Thats because this command could fail silently, (no $? with nonzero if fails) and the only clue you will have is a "ZLib error! -3" message. It's a quick solution because funnily enough you will find ipin.py does uncrush those files.

Read this for yet another tool around pngdefry. It provides an invaluable info about all this stuff -even its source- but I haven't tried myself.

My hope is in pngcrush absorbs those functionality so you have it out of the box, at least I have send a mail to pngcrush maintainer (hi Glenn).

Corcoran answered 5/11, 2013 at 20:31 Comment(1)
I have no plans at the moment to absorb pngdefry capability into the real pngcrush, but I have put a link to pngdefry on the pngcrush page at SourceForge.Mediation

© 2022 - 2024 — McMap. All rights reserved.