Fedora Linux Support Community & Resources Center
  #1  
Old 3rd August 2012, 11:06 PM
wash3393 Offline
Registered User
 
Join Date: Aug 2012
Location: US
Posts: 2
linuxfirefox
Problems Creating a TIFF

I scanned a book with xsane into ~500 PNM files, now I need to turn these files into one multi page TIFF so I can send it over to scantailor but I've run into some issues.

I scanned the first half of the book (250 pages/PNM files) and took a break, every other page I scanned was upside down (because that's how I scanned them in) so I used Image Magick to rotate these pages 180 degrees. Now going back to work on the second half of the book, I opened my project but now xsane can't handle those edited files. I found this post which sounds like what happened to me but this doesn't solve my problem. So I just started a new project in xsane and saved the other half of the book (250 files) into a different folder.

Now I've got these 2 folders which I can't just merge because one folder has a file named image-0001.pnm for page 1 and the other folder has a file named image-0001.pnm for page 251. I tried using the rename function from the command line to edit the file names in mass but it didn't work, after experimenting with it for awhile and not having any luck I gave up. I know Image Magick can turn PNM's into a multi page TIFF, I've done this before, but I haven't seen anything saying it could do so with files from multiple folders like this. I'm hoping someone here can suggest something that doesn't involve individually renaming over 200 files. Is there perhaps a way to merge two multipage TIFF's and not have the pages get out of order? Hopefully all of that made sense.
Reply With Quote
  #2  
Old 4th August 2012, 04:59 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,604
linuxfedorafirefox
Re: Problems Creating a TIFF

Quote:
Originally Posted by wash3393 View Post
Now I've got these 2 folders which I can't just merge because one folder has a file named image-0001.pnm for page 1 and the other folder has a file named image-0001.pnm for page 251.
...
I'm hoping someone here can suggest something that doesn't involve individually renaming over 200 files.
You don't have to rename the files manually; a for loop in bash can do it. Just open a terminal window and cd to the directory containing the pnm files for pages 251 and above, then do this:
Code:
for x in $(/bin/ls -r *.pnm)
do
   num=${x#image-}
   num=${num%.pnm}
   num=$(echo $num | sed 's/^0*//')
   num=$((num + 250))
   /bin/mv $x image-$(printf "%04d" $num).pnm
done
That will rename image-0001.pnm, image-0002.pnm, image-0003.pnm, ..., to image-0251.pnm, image-0252.pnm, image-0253.pnm, ... . You could then put those in the directory containing the real image-0001.pnm, image-0002.pnm, image-0003.pnm, ... , and then use ImageMagick to merge them all.
__________________
OS: Fedora 20 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 5GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #3  
Old 4th August 2012, 06:19 AM
wash3393 Offline
Registered User
 
Join Date: Aug 2012
Location: US
Posts: 2
linuxfirefox
Re: Problems Creating a TIFF

Excellent! This was exactly what I needed , much appreciated.
Reply With Quote
Reply

Tags
creating, problems, tiff

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help on Mozllia tiff plug-in paulcscheung Using Fedora 4 9th September 2009 11:38 PM
Can I fix a corrupted tiff file? leonardevens Using Fedora 3 17th March 2009 01:42 AM
tiff reading mjr Using Fedora 0 16th January 2007 05:15 AM
1.9 Meg TIFF Brings FC3 To it's Knees Flyboy917 EOL (End Of Life) Versions 3 8th May 2005 05:07 PM


Current GMT-time: 17:13 (Saturday, 26-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat