Skip to main content

Multipage tiff to single multipage

1 reply [Last post]
ncastro
Offline
Joined: 2006-02-14

Hi All,

I've been trying to create an application to combine multiple single pages TIFF images into a single multi-page TIFF file.
I did some programming in Java back to school, but I'm totally new to the java imaging stuff.

I have installed the following programs in my machine:
j2re-1_3_1_16-windows-i586.exe
j2sdk-1_4_0_03-windows-i586.exe
jai_imageio-1_0_01-lib-windows-i586.exe
jai_imageio-1_0_01-lib-windows-i586-jdk.exe
jai_imageio-1_0_01-lib-windows-i586-jre.exe
jai-1_1_2_01-lib-windows-i586.exe
jai-1_1_2_01-lib-windows-i586-jdk.exe
jai-1_1_2_01-lib-windows-i586-jre.exe

Any advice to point me the right direction will be great.

I have started getting familiar with JAI and Imagio by reading some tutorials and running some sample code I found online to make sure I have set everything right on my machine. However, the below sample compiles fine, but when I run it, I got the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/media/jai/coec/ImageEncodeParam

import java.util.*;
import java.awt.image.*;
import java.awt.image.RenderedImage;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
//import com.sun.media.jai.codec.*;
//import com.sun.media.jai.codec.ImageEncodeParam;
import com.sun.media.jai.codec.TIFFEncodeParam;
import com.sun.media.jai.codec.ImageEncoder;
import com.sun.media.jai.codec.ImageCodec;
import com.sun.media.jai.codec.ImageEncodeParam;

public class Multipagetiff
{
public static PlanarImage readAsPlanarImage(String filename)
{
return JAI.create("fileload", filename);
}
public static void saveAsMultipageTIFF(RenderedImage[] image, String file )
throws java.io.IOException
{
String filename = file;
//filename = file;
//if(!filename.endsWith(".tiff"))filename = new String(file+".tiff");
if(!filename.endsWith(".tif"))filename = new String(file+".tif");
OutputStream out = new FileOutputStream(filename);
TIFFEncodeParam param = new TIFFEncodeParam();
//ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);
ImageEncoder encoder = ImageCodec.createImageEncoder("TIF", out, param);
//ImageEncodeParam encoder = ImageEncoder.createImageEncoder("TIFF", out, param);
Vector vector = new Vector();

for(int i=1;i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23

Your CLASSPATH setting does not include the requisite jar files or you are using a JVM into which JAI has not been installed.

Brian