[index] [pictures] [about] [how]

Pictures

Table of Contents

Summary

There is now a new section in the website with pictures here.

To generate a new entry the pictures are placed in a subfolder of assets/img and processed with a bash script. They are scaled with ImageMagick's convert command and written to a subfolder:

convert "$image" -resize "800x800" "s/$image"

This command preserves the aspect ratio of the input image (see here) and resizes the picture so that the longer side has a length of 800 pixels.

The list of image links in the .org file for an entry is generated by the following elisp function:

(defun relint/generate-image-links (dir)
  (let* ((image-dir-rel (concat "./assets/img/" dir "/s"))
         (image-dir-abs (expand-file-name (concat "~/web/" image-dir-rel)))
         (dotfile-exclude-pattern "^\\([^.]\\|\\.[^.]\\|\\.\\..\\)")
         (files (directory-files image-dir-abs nil dotfile-exclude-pattern nil nil)))
    (goto-char (point-max))
    (dolist (fname files)
      (insert "\n#+attr_html: :width 500px\n")
      (org-insert-link nil (concat image-dir-rel "/" fname))
      (insert "\n"))))

I would have liked to include the image link generation into the build script, but so far this was not successful. Maybe this will be fixed in the future.

RSS: [index] [pictures] Last build: 2025-01-05 16:27:20