Downward escalator with black ridged steps, yellow edge lines, silver sides, and glass panels.

One Command I Keep Reusing

Every post here needs the same thing done to a handful of files: resize the long edge, sharpen slightly, strip the location data, and write out a copy that is safe to upload. I used to do this by hand and now I do not.

This is not clever and it is not mine originally. It is just the line I have ended up running most often, kept here mostly so I can find it again.

mogrify -path ./web \
  -resize 1600x1600\> \
  -strip \
  -quality 82 \
  -unsharp 0x0.75+0.75+0.008 \
  *.jpg

What each part is for

  • -resize 1600x1600> only shrinks. The trailing marker stops it enlarging anything already smaller.
  • -strip removes the metadata, which includes where the photograph was taken. This matters more than people think.
  • -quality 82 is about the point where I stop being able to tell, on these kinds of images.
  • -unsharp puts back a little of what the resize took away. The numbers are conservative on purpose.

The ./web folder has to exist first, otherwise the command fails with a message that is technically accurate and no help at all. Ask me how I know.

Everything about this is a matter of taste except stripping the metadata, which I would argue is simply good manners when you are posting photographs of places you have been.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *