The scan is a bilevel 300 dpi JBIG2 layer plus lower-resolution colour, so storing every plate as 8-bit PNG only added size. tools/optimize_plates.py writes copies under work/plates-opt (bilevel to generic-mode, lossless JBIG2; genuine halftone to JPEG q88) and repoints work/pages at them; plates/ and src/ are untouched. The Dockerfile builds jbig2enc and adds qpdf, ghostscript and img2pdf. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
32 lines
1.6 KiB
Docker
32 lines
1.6 KiB
Docker
# Toolchain for the Ross-1988 re-typeset project (matches the environment the
|
|
# first two sessions ran in: Ubuntu 24.04, TeX Live 2023, tesseract 5.3, poppler).
|
|
FROM ubuntu:24.04
|
|
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
texlive-xetex texlive-latex-base texlive-latex-recommended texlive-latex-extra \
|
|
texlive-fonts-recommended texlive-fonts-extra \
|
|
fonts-liberation fonts-freefont-ttf fontconfig \
|
|
poppler-utils tesseract-ocr tesseract-ocr-eng \
|
|
python3 python3-pip python3-pil python3-numpy \
|
|
make curl ca-certificates \
|
|
qpdf ghostscript img2pdf \
|
|
git automake autoconf libtool g++ pkg-config libleptonica-dev zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& pip3 install --no-cache-dir --break-system-packages pdfplumber fonttools \
|
|
&& fc-cache -f
|
|
|
|
# jbig2enc: the encoder the ProQuest scan itself uses for its bilevel page
|
|
# layer, and the reason a 2556x3305 page fits in 4900 bytes there. It builds a
|
|
# dictionary of repeated letterforms and stores each shape once, which general
|
|
# compressors cannot do -- measured on this scan, 0.019 bits/pixel against
|
|
# 0.084 for CCITT G4 and 0.159 for 1-bit PNG. Not packaged for Ubuntu 24.04, so
|
|
# it is built from source.
|
|
RUN git clone --depth 1 https://github.com/agl/jbig2enc /tmp/jbig2enc \
|
|
&& cd /tmp/jbig2enc \
|
|
&& ./autogen.sh && ./configure && make -j"$(nproc)" && make install \
|
|
&& ldconfig \
|
|
&& rm -rf /tmp/jbig2enc
|
|
WORKDIR /work
|
|
# The project directory is bind-mounted at /work (see compose.yaml); nothing is copied in.
|
|
CMD ["bash"]
|