A simple API server to convert (multi-page) images using ImageMagick.
Start the server:
# Listen on port 8081
go run main.go --listen=:8081The server exposes three endpoints:
/healthresponds with a JSON status./versionresponds with the Git version used to build the server./convertconverts a (multi-page) image into a Zip archive of single images.
The /convert endpoint can take one or multiple of the following options (as URL parameters):
densitywill set the rendering resolution in DPI (useful for PDF input). Default is300.0.qualitywill set the compression quality for the output images (useful for JPEG output). Default is85.formatwill set the output format, eitherJPEG,PNG, orTIFF. Default itJPEG.layoutwill set the output layout, eitherlandscape,portrait, orkeep. Default iskeep.
# Install ImageMagick v6 (keg-only)
brew install imagemagick@6
# Compile ImageMagick Go bindings
PKG_CONFIG_PATH="/opt/homebrew/opt/imagemagick@6/lib/pkgconfig" CGO_CFLAGS_ALLOW=-Xpreprocessor go install