Hi everyone!
I’ve been building TIFF Inspector, a tool for looking inside TIFF files (directories, tags, storage layout, samples and planes), built on geocaml/ocaml-tiff.
- Live: TIFF Inspector
- Code: GitHub repository (MIT)
It comes as a CLI, an HTTP API and a web UI. Every reported value says where it came from: read from the file, a spec default, or absent. Nothing is guessed.
What might interest OCaml folks
ocaml-tiff fixes. Testing on unusual files turned up a few issues, which I fixed in a vendored copy:
- BigTIFF entries with several small values stored inline (for example,
BitsPerSample=[8,8,8], as GDAL writes them) were unreadable. - Classic TIFF offsets of 2 GiB and above were sign-extended.
SampleFormatstored at an offset rather than inline was not read.- Entry introspection, so tools can see field types and counts.
Independent test fixtures. There are 21 small TIFFs generated by a separate Python writer that shares no code with the parser, plus golden outputs. They might be useful to ocaml-tiff as a conformance set, if the maintainers want them.
An in-browser playground. At /playground, you can write OCaml and run it against ocaml-tiff and the inspector core on sample files, with no install. It’s the toplevel compiled with js_of_ocaml (about 1.3 MB gzipped), running in a web worker. ;; is optional, and compile errors are underlined in the editor.
To get there, I wrote JavaScript implementations of the C primitives used by bstr and checkseum. I’d be glad to offer them upstream if that’s useful.
The server. It uses OCaml 5 with Eio and cohttp-eio. Each upload is inspected in a separate process with time and memory limits, with rate limiting and graceful shutdown. It runs in Docker on a free Render instance.
Feedback welcome
- Does the JSON report shape work for other geospatial tooling?
geocamlmaintainers: would you prefer the fixes as one PR or several small ones?- Any TIFFs that inspect incorrectly? Issues with a sample file are gold.
Thanks for reading!