JAI - Splitting Multi-page TIFs

C

carl.manaster

I've got what I think is a simple task, splitting a multi-page TIF into
separate files by page. I've found a few examples online, but only
one, here:

http://forum.java.sun.com/thread.jspa?threadID=646007&tstart=135

worked - and that only sort of (images came out reversed) and very
slowly (140 seconds for a 30MB file).

Does anyone have a better bit of code to do this, faster?

Thanks in advance.

--Carl
 
A

Andrey Kuznetsov

I've got what I think is a simple task, splitting a multi-page TIF into
separate files by page. I've found a few examples online, but only
one, here:

http://forum.java.sun.com/thread.jspa?threadID=646007&tstart=135

worked - and that only sort of (images came out reversed) and very
slowly (140 seconds for a 30MB file).

Does anyone have a better bit of code to do this, faster?

I think that this is a wrong approach.
There are no need to decode and encode TIFF to split it into separate files.

However I don't have currently a solution for this.

A little bit theorie - you schould be able to copy each ImageFileDirectory
into separate file,
but you have to adjust all offsets (!!!).
 
C

carl.manaster

Hi, Andrey,

Thanks for the help. I have solved it, as you suggest, by "just"
reading the TIFF directly, twiddling the values that represent offsets,
and streaming each IFD to its own file. This would have been easier if
Java had unsigned types, and if my TIFFs used the same byte ordering as
my language.

Peace,
--Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top