pyatoa.utils.images

Utility functions for manipulating image files such as .png and .pdfs. Makes use use of the Python Pillow package if working with .png files, and the PyPDF2 package if manipulating pdf files. Internal imports for all functions to remove Pyatoa-wide dependencies on these packages for short functions.

Module Contents

Functions

merge_pdfs(fids, fid_out)

Merge a list of pdfs into a single output pdf using the PyPDF2 package.

imgs_to_pdf(fids, fid_out)

Combine a list of .png files into a single PDF document

tile_imgs(fids, fid_out)

Combine a list of images into a single, horizontally tiled image.

tif_to_array(fid)

Convert GeoTiff images (e.g., ETOPO1 topography) to a numpy array for

pyatoa.utils.images.merge_pdfs(fids, fid_out)[source]

Merge a list of pdfs into a single output pdf using the PyPDF2 package. Any desired order to the pdfs should be set in the list of input fids.

Parameters:
  • fids (list) – list of paths to .pdf files

  • fid_out (str) – path and name of the resulting output .pdf file

pyatoa.utils.images.imgs_to_pdf(fids, fid_out)[source]

Combine a list of .png files into a single PDF document

Parameters:
  • fids (list) – list of file ids with full pathnames to be combined

  • fid_out (str) – the name of the file to be saved with full pathname

pyatoa.utils.images.tile_imgs(fids, fid_out)[source]

Combine a list of images into a single, horizontally tiled image.

Parameters:
  • fids (list) – list of file ids with full pathnames to be tiled

  • fid_out (str) – the name of the file to be saved with full pathname

pyatoa.utils.images.tif_to_array(fid)[source]

Convert GeoTiff images (e.g., ETOPO1 topography) to a numpy array for conversion and processing

Parameters:

fid (str) – .tif(f) file

Return type:

np.array

Returns:

array of data contained within the tiff file