Vote Charlie!

blog image workflow

Posted at age 35.
Edited .

As a bridge between my bare bones Pelican install and whenever I figure out my full photography workflow, here’s my current hacky approach to getting images on my blog quickly:

  1. Tag photos in Digikam with @blog tag, add captions to the “Caption” field in the Captions editor.
  2. Go to current year album (or month, but this allows for referencing photos across months since I usually blog late) and filter on that @blog tag. Select all.
  3. Export to local storage…
    • Target location: /home/cgorichanaz/projects/website/pelican-content/images
    • Copy files
    • Overwrite existing items in the target
    • Use the album path of the items in the target
    • Adjust image properties
      • Image Length: 3840px
      • Image Quality: 80
  4. Generate a quick Markdown formatted list of the images with captions:
    • (cd ~/projects/website/pelican-content/blog/2023/06; find ../../../images/2023 -type f -iname "*.jpg" -print0 | xargs -0 jhead -ft 1>/dev/null; find ../../../images/2023 -type f -iname "*.jpg" -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | while read filename; do printf '![%s](%s)\n\n' "$(exiftool -s -S -comment $filename)" "$filename"; done)
    • This snippet does the following:
      • Change to the directory the blog Markdown file will be in, so we get correct relative links from the find.
      • Use find to pipe images to jhead, which updates the modification timestamps to match the EXIF data for the image.
      • Use find to print image modification timestamps and filenames, sort, remove the timestamp, and pipe to a while loop.
      • Read each file with exifdata, print the caption and filename in Markdown format.

Next I need to try to make it so I don’t need to manually insert /thumbnails/600x_ into the image path to trigger my thumbnailer plugin. I’d prefer to keep the Markdown clean and have thumbnails be automatically generated in that size. I’ll need to dig into the Python soon. For now I’ll just have bloated filesizes (though smaller than the original images before I was exporting at 3840px from Digikam).

I also need to make this work for PNGs, I just noticed it didn’t grab the captions I added to some screenshots in Digikam.