Link to home
Start Free TrialLog in
Avatar of nlpalmquist
nlpalmquistFlag for United States of America

asked on

Rebuilding a Tif file after extracting pages and replacing page 1

BillDL - posted excellent suggestion to use nconvert to split the pages apart and replace page 1.  It did exactly what I needed - except I am unable to recombine the pages once I get them together.

I got the nconvert as suggested.  

nconvert -xall original.tif

it made 3 files - one for each page - I assume the pattern would continue for larger files:
original_1-0.tif
original_1-1.tif
original_1-2.tif

I made a file called: list.txt and listed the pages I want in the new document - seemed the way to do this.  

list.txt contains:
newpage1.tif
original_1-1.tif
original_1-2.tif

Then I ran the nconvert -multi command like this:

nconvert -multi -l list.txt -o newfile.tif

What it did here was make three new files:
newfile.tif
newfile_1.tif
newfile_2.tif

These would represent the three pages I want in a new file.  I can not figure out how to get them back together with this software.  Am I missing something?
ASKER CERTIFIED SOLUTION
Avatar of BillDL
BillDL
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Once happy that the program creates your multi-page TIF file from the source images, you can add the uppercase -D switch to delete the files that were used as the source, ie. the ones in the list file:

nconvert -multi -l list.txt -o newfile.tif -out tiff -c 2 -D -v > logfile.txt 2>&1
Avatar of nlpalmquist

ASKER

Perfect.  Got it all working yesterday.  It will save a very big pile of paper each day.
Thank you nlpalmquist, I'm pleased that you have saved yourself a pile of work.  Out of curiosity I created a little batch file that allows you to drag and drop a Multi-TIFF file onto it and (almost) automates the process of rebuilding it with the new front page image which it prompts you to name and expects to be in the same folder.  Most of it is just error checking and the commands are just as you will be using though.  I would imagine that you will have created some kind of bath file yourself by now though.
I love your willingness to try it.  That was above and beyond.

I have to run through a few hundred in each process and it needed to have additional rules. I have to create a new first page from a list of orders- PCF converted to TIF,  I have to fetch the old Tiff,  I have to bust the old tiff apart, make a list of the pages in the right order - this worked the best for reassembly.  Some old tiffs had more than 100 pages and the naming that nconvert used made it easy to load them into a list in order, replacing page 1 with the new name.

Then reassemble for the final tiff.

I do all this from our software where I have better tools for doing things.  But your solution got it working. I sent out questions in a few directions - since I could not find the right tool and was almost at the point of hiring a solution - I thought there must be something someone already wrote but could not find it.  Sometimes that is the hardest part when you moving into areas of less familiarity.
Again my thanks.

You're most welcome :-)