Comments (22)
Please refer to pngout installation section in readme.
from image_optim.
@mperice Did it help, can I close this?
from image_optim.
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.
from image_optim.
«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.
from image_optim.
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?
from image_optim.
@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}
from image_optim.
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.
from image_optim.
Yes. If config.assets.image_optim
is a Hash it will be passed directly to initialiser.
from image_optim.
@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?
from image_optim.
I'm having this same issue. Where do I install pngout? For some reason, image optim can't find it.
from image_optim.
@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']
.
from image_optim.
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).
from image_optim.
@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
?
from image_optim.
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).
from image_optim.
@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.
from image_optim.
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
from image_optim.
@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.
from image_optim.
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.
from image_optim.
@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.
from image_optim.
That did it. Thanks!
from image_optim.
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
from image_optim.
@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?
from image_optim.
Related Issues (20)
- incompatible character encodings: UTF-8 and ASCII-8BIT HOT 9
- GPU vs CPU HOT 3
- Extended attribute status already compressed files HOT 4
- [Feature Request] an option to keep tags and comments when optimizing
- `advpng` installed on ubuntu, or OS X via homebrew, _does not_ have a proper version number HOT 14
- Consider OxiPng instead of OptiPNG HOT 2
- Support guetzli
- Specify a temp directory for the temporary files HOT 9
- Invalid cross-device link HOT 10
- After #optimize_image! the image is rotated HOT 1
- Req: Print only the list of optimized images HOT 2
- what are the permissions for here? HOT 3
- jpegoptim worker didn't strip comment HOT 2
- Add support for SVGo 2.x HOT 7
- Work as a pipe
- Don't overwrite by default
- Support webp
- Cannot load YAML config file that uses Range class in Ruby 3.1.x / Psych4.x HOT 2
- Ruby 3.2.0 / Rails 7.0.4 invalid byte sequence in UTF-8 (ArgumentError) HOT 4
- Cannot allocate memory - grep HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image_optim.