Generate srcset images for a variety of resolutions from OCaml

meta

+107 -12
+54
.tangled/workflows/build.yml
··· 1 + when: 2 + - event: ["push", "pull_request"] 3 + branch: ["main"] 4 + 5 + engine: nixery 6 + 7 + dependencies: 8 + nixpkgs: 9 + - shell 10 + - stdenv 11 + - findutils 12 + - binutils 13 + - libunwind 14 + - ncurses 15 + - opam 16 + - git 17 + - gawk 18 + - gnupatch 19 + - gnum4 20 + - gnumake 21 + - gnutar 22 + - gnused 23 + - gnugrep 24 + - diffutils 25 + - gzip 26 + - bzip2 27 + - gcc 28 + - ocaml 29 + - pkg-config 30 + - imagemagick 31 + 32 + steps: 33 + - name: opam 34 + command: | 35 + opam init --disable-sandboxing -a -y 36 + - name: repo 37 + command: | 38 + opam repo add aoah https://tangled.org/anil.recoil.org/aoah-opam-repo.git 39 + - name: switch 40 + command: | 41 + opam install . --confirm-level=unsafe-yes --deps-only 42 + - name: build 43 + command: | 44 + opam exec -- dune build 45 + - name: switch-test 46 + command: | 47 + opam install . --confirm-level=unsafe-yes --deps-only --with-test 48 + - name: test 49 + command: | 50 + opam exec -- dune runtest --verbose 51 + - name: doc 52 + command: | 53 + opam install -y odoc 54 + opam exec -- dune build @doc
+10
CHANGES.md
··· 1 + ## v0.1.0 (2026-01-16) 2 + 3 + Initial release. 4 + 5 + - Core `srcsetter` library for managing responsive image metadata with JSON serialization 6 + - `srcsetter-cmd` CLI tool for batch processing images into responsive WebP variants 7 + - Support for multiple input formats: PNG, WebP, JPEG, JPG, BMP, HEIC, GIF, PDF 8 + - Parallel image processing using Eio fibers 9 + - Generates responsive images at standard breakpoints (320-3840px) 10 + - Outputs `index.json` manifest with image dimensions and variants
+15 -4
dune-project
··· 3 3 4 4 (generate_opam_files true) 5 5 6 - (source (github avsm/srcsetter)) 7 6 (license ISC) 8 7 (authors "Anil Madhavapeddy") 9 - (maintainers "anil@recoil.org") 8 + (maintainers "Anil Madhavapeddy <anil@recoil.org>") 9 + (homepage "https://tangled.org/@anil.recoil.org/srcsetter") 10 + (bug_reports "https://tangled.org/@anil.recoil.org/srcsetter/issues") 10 11 11 12 (package 12 13 (name srcsetter) 13 14 (description "Srcsetter is a library that allows for handling a directory of responsive images suitable for embedding as `<img srcset` tags in a website. It uses the ImageMagick CLI tool to handle the actual processing of images, and the `srcsetter-cmd` package to generate the input to this library.") 14 15 (synopsis "Image srcset library for webp images") 15 - (depends jsont bytesrw)) 16 + (depends 17 + (ocaml (>= 5.1)) 18 + jsont 19 + bytesrw)) 16 20 17 21 (package 18 22 (name srcsetter-cmd) 19 23 (synopsis "Image processing tool to generate responsive images") 20 24 (description "Srcsetter is a CLI tool that processes a directory of images and outputs a directory of responsive images suitable for embedding as `<img srcset` tags in a website. It uses the ImageMagick CLI tool to handle the actual processing of images.") 21 - (depends srcsetter fpath progress cmdliner eio eio_main)) 25 + (depends 26 + (ocaml (>= 5.1)) 27 + srcsetter 28 + fpath 29 + progress 30 + cmdliner 31 + eio 32 + eio_main))
+14 -4
srcsetter-cmd.opam
··· 3 3 synopsis: "Image processing tool to generate responsive images" 4 4 description: 5 5 "Srcsetter is a CLI tool that processes a directory of images and outputs a directory of responsive images suitable for embedding as `<img srcset` tags in a website. It uses the ImageMagick CLI tool to handle the actual processing of images." 6 - maintainer: ["anil@recoil.org"] 6 + maintainer: ["Anil Madhavapeddy <anil@recoil.org>"] 7 7 authors: ["Anil Madhavapeddy"] 8 8 license: "ISC" 9 - homepage: "https://github.com/avsm/srcsetter" 10 - bug-reports: "https://github.com/avsm/srcsetter/issues" 9 + homepage: "https://tangled.org/@anil.recoil.org/srcsetter" 10 + bug-reports: "https://tangled.org/@anil.recoil.org/srcsetter/issues" 11 11 depends: [ 12 12 "dune" {>= "3.17"} 13 + "ocaml" {>= "5.1"} 13 14 "srcsetter" 14 15 "fpath" 15 16 "progress" ··· 32 33 "@doc" {with-doc} 33 34 ] 34 35 ] 35 - dev-repo: "git+https://github.com/avsm/srcsetter.git" 36 + depexts: [ 37 + ["imagemagick"] {os-distribution = "homebrew"} 38 + ["imagemagick"] {os-family = "debian"} 39 + ["imagemagick"] {os-family = "fedora"} 40 + ["imagemagick"] {os-family = "arch"} 41 + ["imagemagick"] {os-family = "alpine"} 42 + ] 43 + post-messages: [ 44 + "This package requires ImageMagick to be installed for image processing." 45 + ]
+10
srcsetter-cmd.opam.template
··· 1 + depexts: [ 2 + ["imagemagick"] {os-distribution = "homebrew"} 3 + ["imagemagick"] {os-family = "debian"} 4 + ["imagemagick"] {os-family = "fedora"} 5 + ["imagemagick"] {os-family = "arch"} 6 + ["imagemagick"] {os-family = "alpine"} 7 + ] 8 + post-messages: [ 9 + "This package requires ImageMagick to be installed for image processing." 10 + ]
+4 -4
srcsetter.opam
··· 3 3 synopsis: "Image srcset library for webp images" 4 4 description: 5 5 "Srcsetter is a library that allows for handling a directory of responsive images suitable for embedding as `<img srcset` tags in a website. It uses the ImageMagick CLI tool to handle the actual processing of images, and the `srcsetter-cmd` package to generate the input to this library." 6 - maintainer: ["anil@recoil.org"] 6 + maintainer: ["Anil Madhavapeddy <anil@recoil.org>"] 7 7 authors: ["Anil Madhavapeddy"] 8 8 license: "ISC" 9 - homepage: "https://github.com/avsm/srcsetter" 10 - bug-reports: "https://github.com/avsm/srcsetter/issues" 9 + homepage: "https://tangled.org/@anil.recoil.org/srcsetter" 10 + bug-reports: "https://tangled.org/@anil.recoil.org/srcsetter/issues" 11 11 depends: [ 12 12 "dune" {>= "3.17"} 13 + "ocaml" {>= "5.1"} 13 14 "jsont" 14 15 "bytesrw" 15 16 "odoc" {with-doc} ··· 28 29 "@doc" {with-doc} 29 30 ] 30 31 ] 31 - dev-repo: "git+https://github.com/avsm/srcsetter.git"