Last active
August 18, 2017 02:08
-
-
Save evadecker/392fb181bf323bb0bc62e1da79efc4ea to your computer and use it in GitHub Desktop.
Join normal and retina images into a multi-page TIFF.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
exportdir = 'new' | |
# Create a 'new' directory to put merged files | |
os.system('mkdir ' + exportdir) | |
# Iterate over files and combine using tiffcp | |
for file in os.listdir('.'): | |
if file.endswith('@2x.tiff'): | |
continue | |
if file.endswith('.tiff'): | |
filename = os.path.splitext(file)[0] | |
# Take file + file@2x and create new.tiff, remove old files, rename new.tiff to original filename.tiff | |
# tiffcp $file.tiff [email protected] new.tiff && rm $file.tiff && rmmv new.tiff $file.tiff | |
os.system('tiffcp ' + filename + '.tiff ' + filename + '@2x.tiff new.tiff && rm ' + filename + '.tiff && rm ' + filename + '@2x.tiff && mv new.tiff ' + exportdir + '/' + filename + '.tiff') | |
# Move files in 'new' back to default directory | |
os.system('mv ' + exportdir + '/* .') | |
# Delete 'new' directory | |
os.system('rmdir ' + exportdir) | |
print "TIFFs joined successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions:
{filename}.tiff
and{filename}@2x.tiff
.cd [drag the directory into terminal]
python tiffjoin.py