pngcrush: uncrush on linux? [closed]

百般思念 提交于 2019-12-07 10:41:26

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/7138700/pngcrush-uncrush-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!