473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Merging TIFFs into a Multi-Page Tiff

We have the following input data file:

KEY File name OrderNo.

001 001_1.tiff 900001
002 002_1.tiff 900002
002 002_2.tiff 900002
002 002_3.tiff 900002
003 003_1.tiff 900003
004 004_1.tiff 900004
004 004_2.tiff 900004

etc

We need to write a Perl script where for multiple records with the same KEY (eg 002 and 004) we need to merge the single record TIFFs into a new file (eg merge 002_1.tiff + 002_2.tiff + 002_3.tiff = 002_new.tiff and also 004_1.tiff + 004_2.tiff into 004_new.tiff).
Any ideas how we can merge the tiff files and also read ahead to the next record to see if KEY value has changed - on change of KEY merge ALL the single records and create a new file.
We'll really appreciate any advice.
Thanks.
Soyab
Aug 13 '10 #1
2 3914
cndg
1
I'll leave the easy stuff (indicated between *asterixes* below) to you. Here's the hard part:-

Expand|Select|Wrap|Line Numbers
  1. use Imager;
  2. my @images;
  3.  
  4. while (*loop_over_your_input*) {
  5.  my $img = Imager->new(file=>$tiffile) or die Imager->errstr();
  6.  if(*ID is different*) {
  7.    Imager->write_multi({ file=> $outputf }, @images) or die "Cannot write: ", Imager->errstr;
  8.    @images=($img); # next one to do
  9.  } else {
  10.    push @images,$img;
  11.  }
  12. }
  13. # *Don't forget to do the last one (hint - add ||!$onepastend++ to your loop above)
  14.  
I'm aware this is an antique question, but it's top in google for this subject, so hopefully my reply will help others :-)
Sep 14 '11 #2
miller
1,089 Expert 1GB
Thanks for the info. Additionally, one could use Image Magick to merge the related tiffs into a single image.

- Miller
Sep 15 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paradox | last post by:
I am using wxImage to display Tiffs and it works great except that it displays a message box for each unrecognized tag in the header. Is there a way to suppress these message boxes. Thanks Joey
3
by: William Ahern | last post by:
I'm looking for resources on splitting and merging XML trees. Specifically, on methods to pare large XML documents into smaller documents which can be merged later. Off of the top of my head, I...
1
by: jhead | last post by:
I need a solution to 'simultaneously' update / insert records into multiple mySQL databases that are identical in structure. Merging the DBs is not a viable solution. I have been using...
3
by: Patrick | last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best,...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
1
by: svdh | last post by:
I have posed a question last saturday and have advanced alot in the meantime. But I am still not there Problem is that I try to merging various fields from various tables in one document in Word...
2
by: Dave Taylor | last post by:
Is there a decent explanation of how menu merging with MDI forms work in VB.NET? I've read through the online help and it still seems that whenever I change menus around or whatever, it breaks...
1
by: kmazur | last post by:
Hello, I have a folder on the server g:\users\logos\. I need to create a web app that will display all the images in that folder (there are gifs, tiffs, jpegs and bmps) in thumbnail format and...
1
by: David C | last post by:
I have a DataList control that shows thumbnails of jpg files. I would like to be able to show other image types, such as tif files. Can I do that in ..Net 2.0, and if so, how do I display them...
1
by: djl531 | last post by:
SQL 2005 database. What I have is a database with user info in it. It is a list of names, dob, drivers license numbers, etc. I have an update that i need to merge into it. So I have an identical...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.