Welcome to BLOGical Thoughts

July 2016


Friday, 1 July, 2016

I have been asked how I adjust the photos I take so they can be displayed on a web page. The photos I take are 3264 X 1840 or are 3648 X 2736 pixels. Those two sizes are way too big to display on a web page, so I use a couple of Linux command line utilities to adjust them. One of the packages I installed is called ImageMagick, which is a set of command line utilities that allow you to create, edit and compose bitmap images. The other package is called mozjpeg, which allows JPEG images to be reduced in size so they may be loaded faster.

Here is how I use the programs.

  1. Change to Directory Containing Photos - 'cd public_html/phuddy_duddies/photos/cinderella_custom/'
  2. Change Image Resolution - 'mogrify -resize 1024x768 *.JPG'
  3. Create Thumbnail Images - 'convert -resize 240x180 *.JPG IMG.thumbnail.JPG'
  4. Compress JPEG Images - '~/ JPG'

Note that to do the compression, I use a shell script called '' that is in my home directory. Here is the script.

# ============================================================
# - Compress JPEG files using mozjpeg
# author: M Burton
# written: 28 Apr 2015
# ============================================================

printf "Syntax:\n JPG\nor\n jpg\n\n"

printf " - Compress JPEG files\n\n"

if [ $# != 1 ]
exit 1


if [ $XTSN != "JPG" ] && [ $XTSN != "jpg" ]
exit 1

ls *.$XTSN >/dev/null 2>/dev/null
if [ $? != 0 ]
printf "There are no $XTSN files in this directory. Nothing to compress.\n"
exit 1

# Convert from JPG to BMP
printf "Converting $XTSN to BMP\n"
for i in *.$XTSN
printf "$i\n"
/opt/mozjpeg/bin/djpeg -bmp $i >$i.BMP
printf "\n"

# Remove the old JPG files
printf "Removing old $XTSN files\n"
rm *.$XTSN

# Convert from BMP to jpg
printf "Converting BMP to jpg\n"
for i in *.BMP
printf "*"
/opt/mozjpeg/bin/cjpeg -quality 80 $i >$i.jpg
printf "\n"

# Remove the old BMP files
printf "Removing BMP files\n"
rm *.BMP

# Now rename from jpg to JPG
# The ren utility is from the UNIX Power Tools book
printf "Renaming *.$XTSN.BMP.jpg to *.$XTSN\n"
~/ren "*.$XTSN.BMP.jpg" "#1.$XTSN"

printf "Compression completed. $COUNTER files processed.\n\n"

As I was driving the '49 Plymouth down to the Paul Bunyon Hayden cruise last Monday, the rear window fell in. There was no damage to the window, so I can install it again, but it's obvious that I ordered the wrong rubber for that installation. I have now ordered the proper rubber for both the windshield and rear window. Just another one of those little things that prevent me from showing the car at more car shows.

Quote of the day:

Its failings notwithstanding, there is much to be said in favor of journalism in that by giving us the opinion of the uneducated, it keeps us in touch with the ignorance of the community.

     Oscar Wilde

Silly sign of the day:

Free/Open Source Software

Security Theater/"Intellectual Property"/Big Brother