This post is only marginally about the DJI Mini 3 drone. What it does address is the method I use to manipulate image sizes, such as this post for posting online in a blog, for example. It’s wonderful to see images or videos in full 4k HDR, but the file sizes are really bad for loading over the Internet, except for those who may have a broadband connection. Here is an example of the difference.
Full size image @ 3.1 MB.
Reduced image @ 152 kB.
The particular image above is reduced to 20% of the original image. It is a compromise between clarity and loading times. What I do for most postings that contain images is reduce the file size using a simple script. The script uses the convert function of the ImageMagick program. This manipulates input files in various ways. The script makefile is just an easy way to perform all the commands automatically, and is executed using make.
The makefile script is in a subdirectory with two other subdirectories, one called fullsize, the other thumbs. It takes all files in the fullsize directory, converts them, then writes them out to the thumbs directory, and finally makes a montage image showing the converted files. For cleanup, a function deletes some or all original and thumb files. From the command line interface (CLI), the available commands are:
make executes the makefile main section, which performs the conversion, based on the SIZE variable percentage.
make clean which deletes the thumbnail files and the montage file.
make clean-all which deletes both fullsize and thumbnail files, and the montage file.
The make command is a basic Linux command, and the makefile contains the commands to execute. make is mostly used to compile programs into executable files.
The makefile contents are listed here:
Code
# For faster execution using all available cores, use: "make -jx" where "x" is number of cores/tasks to execute simultaneously.### Can be used to reduce picture size in addition to making a montage of thumbnails. Just edit the SIZE to whatever you require.# Place originals in fullsize directory for conversion. Originals are not affected or changed.## Example: convert -resize 50% source.png dest.jpg# convert -resize 1024X768 source.png dest.jpg## Commands start with a tab, not spaces.# Thumbnail size in pixels.#SIZE = 1024x768# Thumbnail size in percent.SIZE =20%# The list of original photos to use (fullsize/* refers to all files# in the directory fullsize).ORIGINALS =$(wildcard fullsize/*)# Use the list of originals to build a list of thumbnails (this takes# the list of originals and changes the prefix on each file from# 'fullsize' to 'thumbs').THUMBS =$(ORIGINALS:fullsize/%=thumbs/%)# RULE 1: Generate each thumbnail from its original using the convert# utility from ImageMagick, rotating the image if necessary.thumbs/% : fullsize/% convert $<-thumbnail $(SIZE) -auto-orient $@# RULE 2: Combine all the thumbnails into the montage and display it.montage.jpeg:$(THUMBS) montage $(THUMBS) montage.jpeg display montage.jpeg &# Clean up all thumbnails and delete the montage.clean:$(RM) thumbs/* montage.jpeg# Clean up everything: full and thumbs.clean-all:$(RM) fullsize/* thumbs/* montage.jpeg
Doing the conversion makes it more pleasant for anyone viewing the post containing images. There is a saying, “We will sit at a traffic light for two minutes, but don’t wish to wait 30 seconds for a page to load over the Internet.”
Have a wonderful day, and God Bless you and yours. Bye for now.