Skip to content

Instantly share code, notes, and snippets.

@joefutrelle
Created December 22, 2014 18:11
Show Gist options
  • Select an option

  • Save joefutrelle/ea96dfc075de993d1235 to your computer and use it in GitHub Desktop.

Select an option

Save joefutrelle/ea96dfc075de993d1235 to your computer and use it in GitHub Desktop.
Extract description from #TIFF files using python-tifffile
#!/env/python
import os
from glob import glob
from tifffile import TiffFile
BASE_DIR='{whatever}'
for tfpath in sorted(glob(os.path.join(BASE_DIR,'*.tif'))):
tf = TiffFile(tfpath)
tfn = os.path.basename(tfpath)
desc = tf.series[0]['pages'][0].tags['image_description'].value
print '%s,%s' % (tfn, desc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment