word number: 653
Time: 2021-10-15 17:27:52 +0000
A few days ago, I converted a handbook about maintaining Gumbrih Village’s blog that I made during community service program in my Bachelors in 2014 into a blog post or webpage. Other than to fill my blogs, it is to enrich my online curriculum vitae (CV) where I can link the uploaded handbook as a proof that I actually did it. Anyway, the handbook 56 images because the officers in Gumbrih Village are not as computer literate as millenials today where I have to screenshot the steps in very detail. Not only that 56 is a lot of image to upload to a blog post or web content, back then the screenshot and snipping application are not as developed today. Each images are 3MB (megabyte) large in bmp format which is over most image blog limit which is 1MB. Optimizing the images file size one by one is very tiring. Therefore, I need an application that can do them all at once. I found many online services when I search the term online image compressor on the search engine but most of them are premium services when handling large amount of images. So I relied on installed application on my operating system.
I will go to Windows first because most people are still in this operating system. One software I found convenient is Windows Image Resizer where all you need to do is select all the images within the folder, right click, and choose Resize pictures. Then you are given options which you can explore yourself and in the end just execute with resizing all images at once. The latest news from the developers blog is that Windows Image Resizer is now a part of Microsoft Power Toys.
Almost all Linux operating system are pre-install with Image Magick and if it is not for your case, just go to their website and download. Most people in Linux uses the terminal or command line. The image size became much smaller than using Windows Image Resizer since I convert the bmp to jpg where the conversion already include minimal optimization. The image size was reduced from 3MB to around 150kB. The procedure to convert is as following:
Here is a code to convert 1 bmp image to jpg:
convert image.bmp image.jpg
You can convert multiple files using the following simple command but only if you do not care about the filenames as they will be made random:
convert *.bmp *.jpg
If you are will to replace the files, you can use mogrify command or you can just copy the images to a new folder and mogrify them.
mogrify -format jpg *.bmp
The conventional way to convert multiple files at once is first create an empty file and insert the following code:
for PHOTO in *.[format] do BASE=`basename $PHOTO` convert "$PHOTO" "[folder]/$BASE.[desired format]" done
In my case I made a filename my-convert in the same directory as the images:
for PHOTO in *.bmp do BASE=`basename $PHOTO` convert "$PHOTO" "Linux/$BASE.jpg" done
Proceed in executing the file and if it does not work, use administrator access or root or sudo:
chmod +x my-convert ./my-convert
If you want to do more advance modification, you can check the documenation:
convert --help man convert
If the above commands does not work then search their website.