ChrisTitusTech / website

My HUGO Website that I use for Videos, Blogs, and Redirects
87 stars 46 forks source link

script-for-optimizing-images/ #109

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Script for Optimizing Images

Having Fun with Technology

https://christitus.com/script-for-optimizing-images/

iljo-dp commented 1 year ago

wow this is very cool

dpater1986 commented 1 year ago

Why don't you use Hugo's build in resize with. You can resize the image, change it to webp and you can create multiple images to use in a scrset.

raminsamadi123 commented 1 year ago

Optimize Everywhere

I have made so that you don't need to get into the folder in order to optimize the images instead you could do it wherever you are. This was done on Arch Linux.

All-in-One Install Command

sudo pacman -Syu git && git clone https://aur.archlinux.org/yay-bin && cd yay-bin && makepkg -si && sudo pacman -U yay-bin-11.3.2-1-x86_64.pkg.tar.zst && yay -S jpegoptim optipng imagemagick libwebp -y && git clone https://github.com/VirtuBox/img-optimize.git $HOME/.img-optimize && sudo ln -s $HOME/.img-optimize/optimize.sh /usr/local/bin/img-optimize && sudo chmod +x /usr/local/bin/img-optimize && echo "
#Image Optimization
alias optimize='~/.img-optimize/optimize.sh'
" >> ~/.bashrc && source ~/.bashrc