[2025-10-12 Sun 15:01]
Knocking 1GB off my note vault disk usage by resizing all images to fit in a 1600x900 container.
Used Python and Pillow for the task. Are there faster solutions? You betcha. After the first run applied to this vault, will it matter? Not really.
Ten minutes to write it—after an hour in which Ruby + libvips gave me confusing errors—two minutes or so for the first run, 0-5 seconds for every run from here on.
Choose your battles.
Code Sample
"""Ensure image assets in my primary vault fit in a 1600x900 container."""
import logging
import pathlib
import rich.logging
from PIL import Image, ImageOps
IMAGE_DIR = "~/doc/random-geekery/assets/img"
IMAGE_EXTENSIONS = (".png", ".jpeg", ".jpg", ".JPG")
MAX_WIDTH = 1600
MAX_HEIGHT = 900
CONTAINER_SIZE = (MAX_WIDTH, MAX_HEIGHT)
logging.basicConfig(level=logging.INFO, handlers=[rich.logging.RichHandler()])
logger = logging.getLogger(__name__)
def main():
"""Application entry point."""
img_dir = pathlib.Path(IMAGE_DIR).expanduser()
logger.info("scanning images: folder='%s'", img_dir)
for path in img_dir.glob("**/*.*"):
if path.suffix not in IMAGE_EXTENSIONS:
continue
img = Image.open(path)
width, height = img.size
if width > MAX_WIDTH or height > MAX_HEIGHT:
logger.warning(
"Resizing to container: name='%s', size=%s; container=%s",
path.name,
img.size,
CONTAINER_SIZE,
)
ImageOps.contain(img, CONTAINER_SIZE).save(path)
if __name__ == "__main__":
main()
[2025-10-12 Sun 19:00]
Cutting down vault size was partly so it wouldn’t be so painful to setup and sync Obsidian on the Asahi partition.
Opted for a Flatpak install. Asahi Fedora includes Flatpak, though I needed to add Flathub.
Code Sample
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Installation went fine after that.
Code Sample
flatpak install flathub md.obsidian.Obsidian
Installing Prism Launcher too, to see if maybe I can play some Minecraft on Asahi.
Code Sample
flatpak install flathub org.prismlauncher.PrismLauncher
Not yet. prismrun crashes when I try to add an instance. No errors logged. It just falls over. I’ll have to come back to that. It’s time to feed the critters, and probably boot back into macOS. Still got some other things to putter with, and it’s not as easy pulling data from the macOS partition as it was with Linux + Windows.
But hey at least I’ll have my notes next time I boot into Asahi!