Yazi and ImageMagick for converting photos

  • yazi configuration on nixos that creates keyboard shortcuts for converting photos:
programs.yazi = {
  keymap.manager.prepend_keymap = [
    {
      run = ''
        shell '~/scripts/photo-processor.sh 80 "3000x3000>" 6 "$@"' --confirm
      '';
      on = ["e" "e"];
      desc = "Convert (3K, method 6, q80)";
    }
    {
      on = ["e" "q"];
      run = ''
        shell '~/scripts/photo-processor.sh "" "3000x3000>" 6 "$@"' --confirm --block
      '';
      desc = "Convert - custom quality";
    }
    {
      on = ["e" "r"];
      run = ''
        shell '~/scripts/photo-processor.sh 80 "" 6 "$@"' --block --confirm
      '';
      desc = "Convert - custom resolution";
    }
    {
      on = ["e" "x"];
      run = ''
        shell '~/scripts/photo-processor.sh "" "" "" "$@"' --block --confirm
      '';
      desc = "Convert - all custom";
    }
  ];
};
  • photo-processor bash script that calls imageMagick and convert photos (refer).
    • script is also created the “nix” way:
home.file."${scripts.photo-processor}" = {
  source = ./photo-processor.sh;
  executable = true;
};
  • Reasons why yazi on nixos make sense for this use-case.

Full article: https://tesar.tech/blog/2025-02-20_this_is_how_i_handle_image_files_yazi_nixos_magick

6 Likes