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

pngout not found, linux #39

Closed
mperice opened this issue Feb 21, 2014 · 22 comments
Closed

pngout not found, linux #39

mperice opened this issue Feb 21, 2014 · 22 comments

Comments

@mperice
Copy link

mperice commented Feb 21, 2014

Image_optim v 0.11.1 causes:

rake aborted!
pngout not found

on a debian machine, all packages (advancecomp gifsicle jhead jpegoptim libjpeg-progs optipng pngcrush) are installed.

@toy
Copy link
Owner

toy commented Feb 21, 2014

Please refer to pngout installation section in readme.

@toy
Copy link
Owner

toy commented Mar 2, 2014

@mperice Did it help, can I close this?

@mperice
Copy link
Author

mperice commented Mar 3, 2014

Of course, installing pngout solves the problem. My point was that pngout (as well as svgo) shouldn't be listed as (optional) packages anymore, as they are now apparently a necessity in v0.11.1.

@toy
Copy link
Owner

toy commented Mar 4, 2014

«Optional» was meant about installation, but it is not a good word in this case as all workers are optional and image_optim will fail with an exception if you don't disable a worker with missing binary.

I am going to switch to resolving binaries for all workers by default on init instead of when worker is first used for more controlled environment. And I was going to add ability to warn and skip workers instead of failing if binary can not be found.

@vdh
Copy link

vdh commented Mar 5, 2014

I had some surprise ActionView::Template::Error errors today because the railtie tried to load svgo, which up until now I had no idea existed.

What do I need to do to disable the svgo worker?

@toy
Copy link
Owner

toy commented Mar 5, 2014

@vdh File config echo 'svgo: false' >> .image_optim.yml (or to global config file ~/.config/image_optim.yml) or rails config config.assets.image_optim = {:svgo => false}

@vdh
Copy link

vdh commented Mar 5, 2014

So would that also work for the direct method?

image_optim = ImageOptim.new(pngout: false, svgo: false)

At the moment I'm only using the direct ImageOptim within CarrierWave, so I've disabled the railtie with config.assets.image_optim = false for now.

@toy
Copy link
Owner

toy commented Mar 5, 2014

Yes. If config.assets.image_optim is a Hash it will be passed directly to initialiser.

@toy
Copy link
Owner

toy commented Sep 7, 2014

@mperice @vdh I've switched to resolving binaries during initialisation (on master, not yet released), with exception explaining how to disable workers. Dose this resolve this issue for you?

@jonathanng
Copy link

I'm having this same issue. Where do I install pngout? For some reason, image optim can't find it.

@toy
Copy link
Owner

toy commented Sep 24, 2014

@jonathanng The easiest is to put it into any location in PATH. Note that value of PATH can be different in login shell and other environments, you can check its value in ruby app by logging ENV['PATH'].

@jonathanng
Copy link

It's in my path. I have it both in /usr/bin & /bin.

Does it need a certain naming convention? It's just called pngout. Do I
need the version number?

On Wed, Sep 24, 2014 at 10:33 AM, Ivan [email protected] wrote:

@jonathanng https://github.com/jonathanng The easiest is to put it into
any location in PATH. Note that value of PATH can be different in login
shell and other environments, you can check its value in ruby app by
logging ENV['PATH'].


Reply to this email directly or view it on GitHub
#39 (comment).

@toy
Copy link
Owner

toy commented Sep 25, 2014

@jonathanng /usr/bin or /bin should normally work.
Bin should be named simply pngout.
Can you check that you've downloaded and you are using proper binary for your system/processor - do you get pngout help output if you run just pngout?

@jonathanng
Copy link

When I type pngout in console, i do get the pngout help output.

I'm on Mac, but I'm not sure if that should make a difference.

On Thu, Sep 25, 2014 at 3:42 PM, Ivan [email protected] wrote:

@jonathanng https://github.com/jonathanng /usr/bin or /bin should
normally work.
Bin should be named simply pngout.
Can you check that you've downloaded and you are using proper binary for
your system/processor - do you get pngout help output if you run just
pngout?


Reply to this email directly or view it on GitHub
#39 (comment).

@toy
Copy link
Owner

toy commented Sep 28, 2014

@jonathanng I can't yet understand if the problem is with environment, pngout binary or with image_optim.

Do you run image_optim binary or do you use it from ruby? If former, does image_optim binary work from terminal on png images? If later, does system('pngout') produce output from ruby?

Also please post first line of pngout help output containing its version.

@jonathanng
Copy link

The problem occurs when I run

'bundle exec rake assets:clean'

The error I get

DEPRECATION WARNING: Support for Rails < 4.0.4 will be dropped from Formtastic 4.0. (called from <top (required)> at /Users/jpn/.rvm/gems/ruby-2.1.3/bundler/gems/activeadmin-708e59018cde/lib/active_admin.rb:8)
/Users/jpn/.rvm/rubies/ruby-2.1.3/bin/ruby /Users/jpn/.rvm/gems/ruby-2.1.3/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets
DEPRECATION WARNING: Support for Rails < 4.0.4 will be dropped from Formtastic 4.0. (called from <top (required)> at /Users/jpn/.rvm/gems/ruby-2.1.3/bundler/gems/activeadmin-708e59018cde/lib/active_admin.rb:8)
rake aborted!
ImageOptim::BinResolver::Error: Bin resolving errors:
pngout worker: `pngout` not found; please provide proper binary or disable this worker (--no-pngout argument or `:pngout => false` through options)
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim/worker.rb:56:in `resolve_all!'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim.rb:186:in `create_workers_by_format'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim.rb:54:in `initialize'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim/railtie.rb:24:in `new'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim/railtie.rb:24:in `register_preprocessor'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/image_optim-0.16.0/lib/image_optim/railtie.rb:7:in `block in <class:Railtie>'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `instance_exec'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `each'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/jpn/Development/application/config/environment.rb:7:in `<top (required)>'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/application.rb:103:in `require_environment!'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/railties-3.2.19/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:190:in `block (2 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/jpn/.rvm/rubies/ruby-2.1.3/bin/ruby...]
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:24:in `ruby_rake_task'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:33:in `invoke_or_reboot_rake_task'
/Users/jpn/.rvm/gems/ruby-2.1.3/gems/turbo-sprockets-rails3-0.3.14/lib/turbo-sprockets/tasks/assets.rake:170:in `block (2 levels) in <top (required)>'
/Users/jpn/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
/Users/jpn/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:clean
(See full trace by running task with --trace)

When I type pngout in console, I get:

PNGOUT [In:{PNG,JPG,GIF,TGA,PCX,BMP}] (Out:PNG) (options...)        Feb 21 2013
by Ken Silverman (http://advsys.net/ken)
Mac port assistance by Jonathon Fowler (http://www.jonof.id.au/pngout)
PNGOUT optimizes PNG size losslessly using my own deflate algorithm (not Zlib)
With the right options, it can often beat other programs by 5-10%. Options:
   -c# PNG output color: 0=Gray, 2=RGB, 3=Pal, 4=Gray+Alpha, 6=RGB+Alpha
   -f# PNG output filter: 0=none, 1=x, 2=y, 3=x&y, 4=Paeth, 5=mixed, 6=reuse
   -d# Override default bitdepth: 0(min),1,2,4,8 (valid only in /c0,/c3 modes)
   -s# Select strategy. 0:Xtreme(default), 1:Intense, 2:Longest Match,
       3:Huffman Only, 4:Uncompressed
   -b# Block split threshold (lower=more blocks, 0=1 block/file, default=256)
       Use trial&error! Suggested values to try are: 0,128,192,256,512,1024,..
   -n# Exact number of Huffman blocks (overrides /b#)
   -r  Randomized initial tables (good for many trials with same options)
   -k? 0=Remove optional chunks (default), 1=Keep all
       p=Keep palette indices, s=Keep settings for /c,f,d,b
   -k(Chunk,Chunk,..) Preserve only named chunk(s). Example: -kgAMA,bKGD,tEXt
   -v,q,l Verbose,Quiet,List mode (use '-' as filename to specify stdin/stdout)
   -y  Assume Yes at the 'overwrite file?' prompt
   -force  Write file even if bigger.
   -mincodes#  Workaround for buggy decoders. 1:Zlib 1.2.1 bug, 2:buggy mobiles
The 1st filename is the input. If you omit the output
filename, PNGOUT will use the same filename with a .PNG extension. Examples:
   $ pngout inlarge.bmp outsmall.png           <- writes outsmall.png
   $ pngout duke3d.png -c2 -f3 -b128 -kbKGD -v <- writes duke3d.png if smaller

@toy
Copy link
Owner

toy commented Sep 29, 2014

@jonathanng My previous message was confusing, please check if image_optim bin works from console on png images. If it does, than something is wrong in environment of rails app, check if system('pngout') produces same output from rails console with production environment.

@jonathanng
Copy link

image_optim does work in terminal.

When I type in the Rails console, I get the following:

>> system('pngout')
/usr/local/bin/pngout: /usr/local/bin/pngout: cannot execute binary file

I tried different versions of the image_optim gem and the latest one that isn't giving me problems is

gem 'image_optim', '~> 0.9.1'

Not sure if this helps or not.

@toy
Copy link
Owner

toy commented Sep 29, 2014

@jonathanng Now clearer: cannot execute binary file means that /usr/local/bin/pngout is not a binary for your os (probably you've downloaded one for different os).
I've already thought that it is better to detect "strange/invalid/unknown" binaries in image_optim resolving.
Somewhere in your rails app (or maybe in rvm) PATH variable is changed so that /usr/local/bin gets in front and invalid pngout binary is used.
Compare output of echo $PATH from terminal and puts ENV['PATH'] from rails console.
image_optim up to version 0.9.1 did not include railtie.

@jonathanng
Copy link

That did it. Thanks!

@avinashdvv
Copy link

pngout worker: pngout not found; please provide proper binary or disable this worker (--no-pngout argument or :pngout => false through options) on ------rake db:migrate-----
i am getting this error , how can i disable it
@toy

@toy
Copy link
Owner

toy commented Feb 11, 2017

@avinashdvv You either need to make pngout available in path or disable the worker in yml config or through options to image_optim initialiser. Which version are you using?

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

No branches or pull requests

5 participants