I have yet to find the “perfect” workflow for images for any platform but stumbled on one that could work at least for posts that tend to contain a lot of screenshots.

The thought occurred to me that I could just take the latest screenshot move it to the current directory and rename it to its md5 sum. So I added the following function to my ~/.bashrc.

# MOVE MOST RECENT SCREENSHOT
# Moves the most recent screenshot from the Screenshots directory into the current directory
# 
# An example output would be:
# Screenshot 2024-05-25 at 9.40.31 AM.png =>  7be6a2f02ea74453d5e1912f32680795.jpg
mmrs() {
	EXT=png
	SCREENSHOTS_DIR=`defaults read com.apple.screencapture location`
	LATEST_SCREENSHOT=`ls -1t ${SCREENSHOTS_DIR} | head -1`
	MD5_SUM=`md5 -q "${SCREENSHOTS_DIR}/${LATEST_SCREENSHOT}"`
	mv "${SCREENSHOTS_DIR}/${LATEST_SCREENSHOT}" "./${MD5_SUM}.png"

	# Convert, resize and reduce if imagemagick is present
	if command -v magick &> /dev/null; then
		# NOTE: This keeps the original png
		magick "${MD5_SUM}.png" -strip \
			-resize 1920x \
			-quality 65 \
			-interlace JPEG \
			-sampling-factor 4:2:0 \
			"${MD5_SUM}.jpg"
		EXT=jpg
	fi

	# Copy markdown to clipboard if `pbcopy` exists
	if command -v pbcopy &> /dev/null; then
		echo "![alt](${MD5_SUM}.${EXT})" | pbcopy
	fi

	echo "${LATEST_SCREENSHOT} =>  ${MD5_SUM}.${EXT}"
}

Then I can just take a screenshot normally with CMD+Shift+4 or CMD+Shift+5 and run the bash function to move it into the folder for my page resource:

mmrs

If the situation calls for it the image markdown is already in the clipboard thanks to pbcopy.