Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zopfli worker #18

Closed
wants to merge 5 commits into from
Closed

Zopfli worker #18

wants to merge 5 commits into from

Conversation

kaspergrubbe
Copy link
Contributor

This is initial idea of a Zopfli worker, but after working with it I am not sure it fits into the idea of image_optim.

Zopfli creates a .gz version of the png file, which seems to be incompatible with png openers (Which makes sense).

I took some ideas from https://github.com/mathiasbynens/grunt-zopfli/blob/master/tasks/zopfli.js

brew install zopfli
zopli -i15 image.png # this creates image.png.gz

zopli -c -i15 image.png > image.png # this creates image.png but it is gzipped

Do you have any idea how to approach this?

This references issue #17

@toy
Copy link
Owner

toy commented Nov 4, 2013

You need to use zopflipng instead of zopfli. Also please add zopfli installation to .travis.yml.

@kaspergrubbe
Copy link
Contributor Author

I see, zopflipng is not part of the 1.0.0 release, and seems to be in current master, but not in a version yet.

Perhaps we should wait until Google releases a new version? We could try to ask the developers.

@toy
Copy link
Owner

toy commented Nov 4, 2013

Sure we can ask developer, but I think it is ok to use zopflipng even if there is no version with it.

@toy
Copy link
Owner

toy commented Nov 4, 2013

And there is no package zopfli, you need to compile it from source

@nelsonjchen
Copy link

Imageoptim uses advpng for its zopfli.

advancecomp v1.18 by Andrea Mazzoleni
Usage: advpng [options] [FILES...]

Modes:
  -l, --list            List the content of the files
  -z, --recompress      Recompress the specified files
Options:
  -0, --shrink-store    Don't compress
  -1, --shrink-fast     Compress fast (zlib)
  -2, --shrink-normal   Compress normal (7z)
  -3, --shrink-extra    Compress extra (7z)
  -4, --shrink-insane   Compress extreme (zopfli)
  -i N, --iter=N        Compress iterations
  -f, --force           Force the new file also if it's bigger
  -q, --quiet           Don't print on the console
  -h, --help            Help of the program
  -V, --version         Version of the program

I was just about to rebase and polish up the commits for the fixed version of this branch along with the necessary Travis-CI fixes and stuff before I do a pull request with a fixed version of this but then I decided to take a look at ImageOptim was doing. 😔

Then I looked at the default for the advpng worker. Guess what? -4 is the default.

@nelsonjchen
Copy link

Wait, nevermind. I have no idea where I got that idea where ImageOptim was using advpng for zopfli. They actually use a fork.

https://github.com/pornel/zopfli

@kaspergrubbe
Copy link
Contributor Author

How nice that advpng uses zopfli, that is pretty nice. I guess that makes this PR not needed, I was also tired of waiting on zopflipng.

@toy
Copy link
Owner

toy commented Jan 12, 2014

@nelsonjchen @kaspergrubbe I've already noticed that advpng uses zopfli, I was just thinking that image_optim should probably check version of advpng to warn if it is an outdated version without zopfli support, otherwise creating zopfli worker is redundant.

@toy toy closed this Jan 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants