Skip to main content

Create a PDF contact sheet from a set of images

Project description

imagecatalog

Docs PyPI Python Version License codecov

Create a PDF contact sheet from a list of files.

Installation

Install from PyPI

pip install imagecatalog

or get latest dev version from GitHub.

pip install git+https://github.com/tdmorello/imagecatalog.git

Usage

Command line

# for full list of options
imagecatalog -h
imagecatalog -i images/*.png -o example.pdf --title 'Image Catalog'

PDF output

imagecatalog   \
    -i images/*.png \
    -o example_landscape.pdf \
    --rows 2   \
    --cols 4   \
    --orientation landscape \
    --title 'Catalog with Landscape Layout' \

PDF output

File paths and metadata can also be supplied from a csv file with headers "image", "label", "note"

$ head -n5 sample.csv
image,label,note
images/image_00.png,Image 0,image 0 note
images/image_01.png,Image 1,image 1 note
images/image_02.png,Image 2,image 2 note
images/image_03.png,Image 3,image 3 note
imagecatalog --csv sample.csv --title 'Catalog from CSV' -o example_csv.pdf

PDF output

Other features: apply image filters

imagecatalog -i images/*.png -o catalog.pdf \
    --invert    \
    --grayscale \
    --autocontrast

integrate with shell utilities

# make a catalog with all images created within the last day
find . -ctime 1d | xargs imagecatalog -o catalog.pdf -i

use regular expressions to filter files

# make a catalog with images that have '1' and/or '2' in the filename
imagecatalog -i images/*.png -o catalog.pdf --regex '.*(1|2).*'

Scripting

from imagecatalog import Catalog

# Catalog inherits from FPDF
# see https://github.com/PyFPDF/fpdf2 for more methods
catalog = Catalog()

# optionally add a title
catalog.set_title("Image Catalog")

# grab a set of existing images from a local directory
images = [f"images/image_{i:02}.png" for i in range(12)]

# optionally add labels (defaults to filenames)
labels = [f"Image {i}" for i in range(len(images))]

# optionally add notes
notes = [f"note for image {i}" for i in range(len(images))]

# generate the pdf
catalog.add_page()
catalog.build_table(images, labels, notes, rows=4, cols=3)

# save
catalog.output("example.pdf")

Contributions

imagecatalog uses poetry for building and package management. Pull requests are welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imagecatalog-0.1.6.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

imagecatalog-0.1.6-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file imagecatalog-0.1.6.tar.gz.

File metadata

  • Download URL: imagecatalog-0.1.6.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for imagecatalog-0.1.6.tar.gz
Algorithm Hash digest
SHA256 4a41862e8dd2eed2954331cd70d54c3ca58b25652525486ef1e4a7294e05fec8
MD5 3ac132d68c01750e6ed6326e1ea6ffcb
BLAKE2b-256 09c026f61815af061e1b5887630f6868b8c63f167946a527695ab81a36df9bae

See more details on using hashes here.

File details

Details for the file imagecatalog-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: imagecatalog-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.11.0-1022-azure

File hashes

Hashes for imagecatalog-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b91e29cceecf8b2d9c00bff189762637e2f1058bef9e975ffc94aab0e1ced6d6
MD5 3242c0ffcd26fb72723219ffcb2c14d4
BLAKE2b-256 f25cb71903517bfc4caad4cad27ac7fab55c0ca2c9d8a8a55f03f11add97056c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page