After a few attempts, I have automated the process for optimizing images for JamilGhar. As my wife adds images to the project’s git repository, a bash script that runs on regular intervals will compress them. The end result is fantastic because she no longer has to wait on me to manually optimize them for her and the Raspberry Pi that sits under my desk is being very useful.
Why is optimizing images important?...
One of the most important workflows for our food recipe blog (JamilGhar) is image optimization. My wife uploads images to our GitHub repository and, when prodded, I run a bash script that decreases image sizes and removes extraneous information from the files. The script is a constant work in progress and I have a few posts (1,2) about it on here.
Lately, I have been considering downloading the repository on a Raspberry Pi and running the script as a scheduled job....
This blog has been a nice source of motivation to continue improving my code and development processes. In my previous post, I discussed the process of writing a Bash script to resize and optimize images for publishing to our family’s recipe blog. I mentioned that one improvement I could make is to automate the process of identifying which files needed to be resized.
The original script I place large images into the “optimize” directory which are then backed up and processed when I run the following script....
When we first started adding photos of food to JamilGhar, we did not think about image size. The average image we posted to the blog was between 2 and 8 megabytes and the resolution was over 3000 x 3000 pixels. The image below is an example.
For most blogs, images should be less than 1000 pixels in the longest direction and preferably less than 100 kB. Featured or “hero” images can be up to 500 kB if used sparingly....