toy / image_optim

Optimize images using multiple utilities
https://github.com/toy/image_optim
MIT License
1.52k stars 109 forks source link

Add path option to config file to specify additional search paths #117

Open danudey opened 8 years ago

danudey commented 8 years ago

It would be nice if the config file had a path option to add another location to the search path. Ideally a list of paths to search, but a single path suffices for my purposes. I've already patched our own local version with an ugly hack, but I figure other users could probably benefit from a properly-written patch. This seems like a more user-friendly option than modifying the PATH environment variable, too.

toy commented 8 years ago

Could you please describe a bit in which situation do you need it? Besides modifying PATH you can also use XXX_BIN environment variables, but I assume it will not be more helpful.

danudey commented 8 years ago

Because we are running an older Ubuntu version, I compiled a new libpng and new versions of every tool, to make sure we have the latest performance and fixes. Because I don't want to affect other software, it's all installed in /opt/image_optim/bin (so /opt/image_optim/bin/pngquant, /opt/image_optim/bin/pngcrush, etc.).

I see that image_optim looks in a lot of places (/usr/bin, /usr/local/bin, etc), but I feel like if someone needs to look in a separate location, like /opt/bin or ~/bin or something, they're going to have more than one binary there.

For us we can always change all of the XXX_BIN but that's a lot of environment variables. We can also change PATH but that can be problematic because we are calling image_optim from a few scripts and I don't want to change all of them to export PATH, but I also don't want to add it to the global PATH either.

I hope this makes sense. I did try to make the change myself, but ruby projects are very complicated for people who have never used ruby before.

toy commented 8 years ago

Yes, sure, I've assumed something like this. Just to check: would image_optim_pack be an option for you?

danudey commented 8 years ago

According to my developer:

That said image_optim_pack's pngquant is outdated, we want 2.x

Generally if I'm installing software I like to compile it myself, but if image_optim_pack can be updated then it would be an option for us in the future. Still, I prefer to do it myself when possible.

toy commented 8 years ago

But it is 2.5.2 — https://github.com/toy/image_optim_pack/blob/v0.2.1.20151113/Makefile#L16 (Which is the latest https://raw.githubusercontent.com/pornel/pngquant/master/CHANGELOG) Also I understand the point of compiling yourself, so then yes it would be helpful to have an option to specify which bin paths to search through.

danudey commented 8 years ago

Well I don't know what to tell you then, I guess the developer was wrong.

I still think it would be a useful feature, but I guess I could have saved a few hours of compiling too.