Skip to content


Subversion checkout URL

You can clone with
Download ZIP


OptiPNG with unix #147

rrelmy opened this Issue · 4 comments

2 participants


I am using the build script under Fedora.
OptiPNG does not work as expected, so I tracked down the reason.
See issues: #39 #46

I want to ask if there are reasons for what had done before and if following suggestions would fix it without breaking Windows/Mac.

First problem: OptiPNG version regex

OptiPNG shows a new word «version» between name and number
See my commit rrelmy@a259724

Second problem: / the strip-meta-tags argument

The variable is set to windows even on unix. In the «if os = unix» statment the variable is not set back to «unix» as in the imagesjpeg target.
Is there a reason for it?

The bigger problem build.xml:1002
Under unix the variable ${strip-meta-tags} is always set to an empty string.

If this variable is empty, an empty argument gets passed to optipng. When this happens following error occurs, see #39

** Error: The option -out requires one input file

This happens only if the variable is empty, if its set to «-strip all» everything works fine.


  1. correctly set ${}
  2. remove build.xml:1002
  3. if ${strip-meta-tags} is empty set it to something
    <equals arg1="${strip-meta-tags}" arg2="" />
        <var name="strip-meta-tags" value="-quiet"/>

Number 3 could be improved, but the argument «-quiet» two times should not make any trouble ;)
<apply> does not accept nested <if>'s ...

With those things fixed optipng works well under linux, but I dont know if it breaks building under Windows or Mac!


Fedora 64bit

$ ant -version
Apache Ant(TM) version 1.8.4 compiled on May 22 2012


$ optipng -version
OptiPNG version 0.7.4
@rrelmy rrelmy referenced this issue from a commit in rrelmy/ant-build-script
@rrelmy rrelmy #147 - fix optipng under unix 92a5f74

Can you supply a pull request for the first problem?

Can you supply a separate pull request for the second problem so I can test it on Windows/Ubuntu and can maybe find someone with a Mac to test it.

@rrelmy rrelmy referenced this issue from a commit in rrelmy/ant-build-script
@rrelmy rrelmy #147 - fix optipng under unix b34c8c8

Sent you the two separate pull requests

@roblarsen roblarsen referenced this issue from a commit
@roblarsen roblarsen Reworked the two PNG tasks.
This will close
#163 Image Optimization Broken on Linux/Mac
#147 OptiPNG with unix
#141 You have optipng installed and your version is: usage: grep (Mac OS Lion Mountain)
#149 - fix optipng version regex

i hear nothing. i see nothing. i close.

@roblarsen roblarsen closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.