Closed baskaufs closed 2 years ago
For historical background, the script get_image_dimensions.ipynb was used to scrape the image directories to get the filenames, then to use PIL to pull the dimensions from the file metadata. The file image_dimensions.csv
was the output of the script. The script image_screening.ipynb used the information in the image_dimensions file along with copyright information to determine whether the images had enough resolution to be uploaded (also it was a crosscheck against the overall works database to see if there actually was an image for the work). I think that code got incorporated in the overall image upload script, since the image_screening file didn't really have any output.
The script tiff_conversion_tests.ipynb includes the testing that I did for creating tiled pyramidal TIFFs. Most of the tests were failures -- the final result was that using the command line
os.system('convert 1979.0342P.tif -define tiff:tile-geometry=256x256 -depth 8 ptif:1979.0342P_tiled.tif')
with the convert
command from ImageMagick was the simplest way to do it. The original notes are in Steve's personal issue tracker, with salient parts to follow. Note: gave up on trying to use PyMagick and Wand (Python bindings of ImageMagick) and instead just installed the command line version.
References:
TiffFile library https://pypi.org/project/tifffile/ YouTube video showing how to make pyramids with OpenCV https://www.youtube.com/watch?v=8yvln2atFkA TIFF conversion using VIPS https://iipimage.sourceforge.io/documentation/images/ Writing mulitpage TIFFs with Python https://www.scivision.dev/writing-multipage-tiff-with-python/ How to create tiles from tiff file using python? https://gis.stackexchange.com/questions/231149/how-to-create-tiles-from-tiff-file-using-python
Wand installation at: https://docs.wand-py.org/en/0.2.4/guide/install.html
Blog post giving syntax: https://legacy.imagemagick.org/discourse-server/viewtopic.php?t=20193
Need to incorporate the test script for generating the tiled pyramidal TIFFs into the processing workflow. Also need to generate them for all existing images that are being served by the IIIF server and replace those currently in the S3 bucket with the new ones.