Skip to content

Instantly share code, notes, and snippets.

@majenkotech
Created July 8, 2025 18:58
Show Gist options
  • Save majenkotech/073b60acb27313acd2d3b476a3996f8b to your computer and use it in GitHub Desktop.
Save majenkotech/073b60acb27313acd2d3b476a3996f8b to your computer and use it in GitHub Desktop.
Makefile for converting JPG files into a monochrome PDF
PDF=MCV11-D_Reference_Card
CONTRAST=45
PNGS=$(patsubst %.jpg,%.png,$(wildcard *.jpg))
${PDF}-ocr.pdf: ${PDF}.pdf
ocrmypdf $^ $@
${PDF}.pdf: ${PNGS}
magick $^ $@
.SUFFIXES: .jpg .png
.jpg.png:
magick $^ -level ${CONTRAST}%,${CONTRAST}% -colors 2 -type bilevel $@
clean:
rm -f *.png *.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment