Skip to content

Instantly share code, notes, and snippets.

View dd388's full-sized avatar

Dianne Dietrich dd388

  • Cornell University Library
View GitHub Profile
@kgjenkins
kgjenkins / readme.md
Last active December 9, 2024 23:36
TIFF compression options

TIFF compression options

Summary

Realistically, especially when considering the inherent noise in the original image, I'd settle for lossy compression with COMPRESS=JPEG JPEG_QUALITY=90, which could reduce file size fairly quickly to 16% of the original.

But if lossless compression is a hard requirement, I'd probably go with COMPRESS=LZW PREDICTOR=2. However, I would want to verify that any downstream tools would support this sort of compression.

UPDATE: When saving with JPEG compression, further speed and size improvements are gained by adding PHOTOMETRIC=YCBCR, which uses a different color space that has even better compression. I've added new rows to the table for YCBCR, as well as .jp2 formats.

@jb221467
jb221467 / thumbnails2excel.py
Created February 2, 2018 18:49
Thumbnails and filenames into Excel spreadsheet
"""
Thumbnails & metadata to Excel
Writes images, filenames, and identifiers to an excel file.
JPEGs should be no more than 150 pixels on the long edge.
Input file is a CSV with columns for 'Filename' and 'Identifier'
where 'Filename' values match actual filenames.
Last edited 2/2/2018 by Jasmine Burns, [email protected]"""
@bitsgalore
bitsgalore / isobuster-report-demo.py
Last active March 10, 2025 11:10
Script that demonstrates custom DFXML reports in IsoBuster (scroll down for example output file)
#! /usr/bin/env python
"""Script that demonstrates custom DFXML reports in IsoBuster"""
import os
import subprocess as sub
def launchSubProcess(args):
"""Launch subprocess and return exit code, stdout and stderr"""
try:
# Execute command line; stdout + stderr redirected to objects
@JonathanThorpe
JonathanThorpe / wav-riff-reader.py
Last active May 8, 2025 13:56
Python WAV File RIFF Header Reader
import struct
import io
class WAVFile:
def __init__(self, filename):
self.filename = filename
def read(self):
with io.open(self.filename, 'rb') as fh:
@whophil
whophil / recursive_glob.py
Last active August 2, 2018 02:55
Recursive glob in Python: Find all files matching a glob-style pattern. Adapted from http://stackoverflow.com/a/2186565/6191541
import os
import fnmatch
def recursive_glob(rootdir='.', pattern='*'):
"""Search recursively for files matching a specified pattern.
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
"""
matches = []
@oswaldoacauan
oswaldoacauan / swfextract
Created March 22, 2015 02:50
SWFExtract All Files
#!/bin/sh
for i in ./*.swf ; do
for j in `swfextract $i | grep -E PNGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract png $j";
swfextract -p "$j" "$i" -o "$i"_"$j".png
done
for j in `swfextract $i | grep -E JPEGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract jpeg $j";
swfextract -j "$j" "$i" -o "$i"_"$j".jpg
done