-
Notifications
You must be signed in to change notification settings - Fork 3
Rob | Labs edited this page Jul 19, 2019
·
1 revision
Use these notes to evaluate the resulting PDF from atlante
.
Discussion on how to analyze PDFs from Maptoolkit after they have been generated. The command line tool is called mutool
from mupdf.com. The data extracted can be used to:
- Verify the resolution (pixels per inch) is sufficient for printing
- Verify
atlante
command lines such as--dpi
- Verify the True Type Fonts used
- Inspect image width and height
Extract images and font files from a PDF using mutool extract
. Output is *.ttf
, *.png
.
-
brew install mupdf-tools
# macOS - Or, https://mupdf.com
Example Usage
# extract
mutool extract output.pdf
# brew install tree # macOS
# Output from `tree .`
├── BXHVIO+<root-font-name>-0019.ttf # TTF file 1/2
├── YKBIWE+<root-font-name>-0014.ttf # TTF file 2/2
├── output.pdf # this is the original PDF
├── img-0007.png # this is the png data that was in the PDF stream
Using Image Magick, list the image dimensions.
# brew install imagemagick # macOS
# Basic usage
# magick identify img-0007.png
# magick identify -verbose -ping img-0007.png
PNG_FILE=img-0007.png
# with formatting
# Result: width x height = 8563 x 5076
magick identify -format "width x height = %w x %h\n" $PNG_FILE
# Image Magick can convert from pixels to inches
# ppi=72
# Result: 118.931 by 70.5 inches
magick identify -format "%[fx:w/72] by %[fx:h/72] inches\n" $PNG_FILE
# ppi=144
# Result: 59.4653 by 35.25 inches
magick identify -format "%[fx:w/144] by %[fx:h/144] inches\n" $PNG_FILE
# ppi=288
# Result: 29.7326 by 17.625 inches
magick identify -format "%[fx:w/288] by %[fx:h/288] inches\n" $PNG_FILE
# ppi=300
# 28.5433 by 16.92 inches
magick identify -format "%[fx:w/300] by %[fx:h/300] inches\n" $PNG_FILE
The SVG template is used to compute the image dimensions. You can use this command to see what was computed in the output.svg
.
cat output.svg | grep image
# result, units are SVG units, or points
# <image width="140.75" height="269" xlink:href="output.png"/>
Analysis of NOAA PDF charts
- As of Summer 2019, a NOAA Notice to Mariners is a 400 ppi image with no fonts nor vector data
- From https://www.charts.noaa.gov/InteractiveCatalog/nrnc.shtml
-
wget https://charts.noaa.gov/PDFs/18773.pdf
# San Diego
Using mutool
to analyze NOAA Chart - 18773
# Page Size from macOS Preview
# 48.77 × 35.27 inches
# Extract data from NOAA chart around San Diego
mutool extract 18773.pdf
# `tree .`
# └── img-0002.png
# 0 directories, 1 file
# Compute width x height for the resulting PNG
PNG_FILE=img-0002.png
magick identify -format "width x height = %w x %h\n" $PNG_FILE
# result
# width x height = 19504 x 14108
# Pixels Per Inch calcuations
# 19504 / 48.77 = 400 ppi
# 14108 / 35.27 = 400 ppi