Comments (16)
image_optim
is not the fastest thing (for png files) to run so I am not sure about running every time during deployment, it is better to optimize images before putting them into app repository. Though this needs to be checked.
Also I am really low on time, so don't hesitate if you have time and you are ready to do this :)
from image_optim.
Hi, guys, I really like the idea of replacing the core of sprockets-image_compressor with image_optim, but there would be one big regression: Image_optim won't currently work on Heroku because they don't have the binaries installed on their servers. I've statically compiled Heroku-friendly pngcrush and jpegoptim binaries and vendored them into sprockets-image_compressor to get around this issue. @toy, what are the odds of something similar happening here?
P.S. I'm running sprockets-image_compressor on deployment on about a dozen sites, and while not blazing fast, the overall asset compilation speed is acceptable.
from image_optim.
It may be a better idea to create separate gem with statically compiled binaries per platform and setting default_bin for each worker, otherwise image_optim will be a heavy gem. There is a problem with pngout as it can not be redistributed «without consent and agreement of creator».
It may be better to tune settings of compressors, as now they are making process very slow gaining few extra percents of compression.
Just to mention — I already used image_optim for paperclip post processor and it works very well there.
from image_optim.
@botandrose: just to be sure that you read previous one
from image_optim.
Thanks guys. Good discussion and nice points. Not sure what the outvome will be but hopefully someone wilvome up with an even better solution integrating all these nice solutions while still ensuring good performance etc.
from image_optim.
Guys, while your thrilling effort doesn't take off, how do you suggest setting up a nice integration of image_optim with a production rails app ?
What about not running every time during deploy as an asset preprocessor, but maybe every time AFTER deploy ? So deploy doesn't take forever and you leave the script running after deploy is finished ?
from image_optim.
For those that came here after googling (like me).
I have created a bin gem that allows you to run image_optim on heroku:
https://github.com/mooktakim/image_optim_bin
from image_optim.
Creating sprocket preprocessor appeared to be very simple, checkout rails branch, especially: https://github.com/toy/image_optim/blob/rails/lib/image_optim/railtie.rb
from image_optim.
Cool 👍
from image_optim.
@mooktakim I've finally managed to create bin pack for image_optim
— image_optim_pack. Working on heroku — https://iopack.herokuapp.com/.
Pack doesn't include svgo and I am not sure that it will be easy to pack it and doesn't include pngout due to its license. I'll try to contact Ardfry Imaging, LLC about including it. Could you please tell me if you've got an agreement with them and if it was easy?
from image_optim.
Hey @toy,
I didn't get in contact with them. I was just using it for myself. I'm not sure how easy it would be to get permission to include it.
from image_optim.
Hey @toy
I'm attempting to get image_optim_pack pushed to Heroku. I tried using @mooktakim's build pack but fails while precompiling assets. Do you know of any other methods of getting your bin pack to build on Heroku?
from image_optim.
@ghostropic
Do I understand right that image_optim_pack
itself also doesn't work? Can you share errors?
One way to get binaries is to build them using Makefile from that gem.
Maybe it is also better to move this to a separate issue for that project.
from image_optim.
@toy Sorry for the confusion. Image_optim_pack
does work locally, but isn't useful to me unless I can get it working on Heroku, so I thought i'd ask if you had any leads on a build pack. I suppose my only option though is to learn to write my own.
from image_optim.
@ghostropic Ah no, I understood you, but my questions were confusing. As I understand heroku gives you ubuntu servers and image_optim_pack
should work on ubuntu. So does it not work on heroku and which errors do you get? And one way to get binaries is to use make
on machine you are targeting, so on heroku instance.
from image_optim.
@ghostropic As there was already a heroku app to check versions, I've added there a very basic upload with optimisation for checking if everything works, and it seems it does: https://iopack.herokuapp.com/
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.