Compressing TIFF Image

Hi guys,
Am trying to convert images on a folder to an TIFF format, It's working but the size of TIFF is too high. I have tried to compress the tiff using JAI encoder, still it's not working. Any body help me to reduce or compress the TIFF size on this please.
class imageFolder
     private static ImageEncoder enc = null;
     public boolean createTiffImage(String Foldername)
          try
               File dir = new File(Foldername);
               String[] children = dir.list();
               if (children == null)
                    System.out.println("No Images");
                    return false;
               else if (children.length == 0)
                    System.out.println("No Images");
                    return false;
               else
                    ImageWriter writer = null;
                    Iterator iter = ImageIO.getImageWritersByFormatName("tiff");
                    if (iter.hasNext())
                    writer = (ImageWriter)iter.next();
                    ImageOutputStream ios = ImageIO.createImageOutputStream(new File(Foldername+"ParentFile.tiff"));
                    writer.setOutput(ios);
                    FileInputStream ins = new FileInputStream(Foldername+children[0]);
                    BufferedImage img = ImageIO.read(ins);
                    ByteArrayOutputStream out = new ByteArrayOutputStream();
                    TIFFEncodeParam param = new TIFFEncodeParam();
                    param.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);
                    ImageEncoder tiffEncoder = ImageCodec.createImageEncoder("TIFF",out, param);
                    tiffEncoder.encode(img);
                    System.out.println("File is created in the folder " + Foldername);
                    TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US);
                    tiffWriteParam.setTilingMode(ImageWriteParam.MODE_EXPLICIT);
                    Graphics2D big = img.createGraphics();
          big.setFont(new Font("Dialog", Font.PLAIN, 10));
          big.setColor(Color.red);
               //big.drawString("", 4, 12);
          big.drawString("Sample Number", 4, 12);
                    writer.write(new IIOImage(img, null, null));
                    for (int i=1; i<=children.length; i++)
                         System.out.println(children.length);
                         ins = new FileInputStream(Foldername+children);
                         img = ImageIO.read(ins);
                         big = img.createGraphics();
               big.setFont(new Font("Dialog", Font.PLAIN, 10));
               big.setColor(Color.red);
                    big.drawString("", 4, 12);
               big.drawString("Sample Number", 4, 12);
                         writer.writeInsert(i, new IIOImage(img, null, null), null);
                    encodeAsTIFF(img,"ParentFile.tiff");
                    ios.flush();
                    writer.dispose();
                    ios.close();
                    return true;
          catch(Exception e)
               e.printStackTrace();
               return false;
     public static void main(String a[]) throws IOException
          imageFolder m1 = new imageFolder();
          String Foldername="e:/images/";
          System.out.println(m1.createTiffImage(Foldername));
     private static void encodeAsTIFF(BufferedImage bi, String outputFile) {
try {
outputFile = removeLastExt(outputFile)+".tiff";
OutputStream os = new FileOutputStream(outputFile);
TIFFEncodeParam param = new TIFFEncodeParam();
enc = ImageCodec.createImageEncoder("TIFF", os, param);
enc.encode(bi);
os.close();
} catch (IOException e) {
System.out.println("IOException at TIFF encoding..");
System.exit(1);
private static String removeLastExt(String name) {
int li = name.lastIndexOf(".");
return name.substring(0, li);

Hi,
This is the code I use to code compresses tiff images, it handles multi-page tiffs and could be of use.
I think the problem with your code is that the line tiffEncoder.encode(img); writes the output to the OutputStream associated with the ImageEncoder and doesn't modify the original RenderedImage.
public static byte[] compressTiff(byte[] data)
    try
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ImageReader reader = (ImageReader)ImageIO.getImageReadersByFormatName("tiff").next();
        ImageInputStream imageInputStream =
            ImageIO.createImageInputStream(new ByteArrayInputStream(data));
        reader.setInput(imageInputStream);
        Iterator writers = ImageIO.getImageWritersByFormatName("tiff");
        ImageWriter writer = (ImageWriter)writers.next();
        int numPages = reader.getNumImages(true);
        List images = new ArrayList();
        for (int i = 0; i < numPages; i++ )
            images.add(reader.read(i));
        ImageOutputStream ios = ImageIO.createImageOutputStream(bos);
        writer.setOutput(ios);
        TIFFImageWriteParam param = new TIFFImageWriteParam(Locale.getDefault());
        param.setCompressionMode(TIFFImageWriteParam.MODE_EXPLICIT);
        param.setCompressionType("Deflate");
        BufferedImage firstIioImage = (BufferedImage)images.remove(0);
        writer.write(null, new IIOImage(firstIioImage, null, null), param);
        for (int i = 0; i < images.size(); i++)
            writer.writeInsert(i + 1, new IIOImage((BufferedImage)images.get(i), null, null), param);
        writer.dispose();
        ios.close();
        return bos.toByteArray();
    catch (IOException ex)
        throw new RuntimeException(ex);
}

Similar Messages

  • Compressing TIFF images

    How can I compress TIFF images? Is it possible through setCompression() ? I have written the following program:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.image.renderable.*;
    import java.io.*;
    import javax.media.jai.*;
    import javax.media.jai.widget.*;
    import com.sun.media.jai.codec.*;
    public class TIFFTrial extends Container {
    private ImageEncoder encoder = null;
    private TIFFEncodeParam encodeParam = null;
    public static void main(String args[]) {
    TIFFTrial jtest = new TIFFTrial(args);
    // Load the source image.
    private PlanarImage loadImage(String imageName) {
    //ParameterBlock pb = (new ParameterBlock()).add(imageName);
    PlanarImage src = JAI.create("fileload", imageName);
    if (src == null) {
    System.out.println("Error in loading image " + imageName);
    System.exit(1);
    return src;
    // Create the image encoder.
    private void encodeImage(PlanarImage img, FileOutputStream out) {
    encoder = ImageCodec.createImageEncoder("TIFF", out, encodeParam);
    try {
    encoder.encode(img);
    out.close();
    } catch (IOException e) {
    System.out.println("IOException at encoding..");
    System.exit(1);
    private FileOutputStream createOutputStream(String outFile) {
    FileOutputStream out = null;
    try {
    out = new FileOutputStream(outFile);
    } catch(IOException e) {
    System.out.println("IOException.");
    System.exit(1);
    return out;
    public TIFFTrial(String args[]) {
    //encodeParam.setCompression( encodeParam.COMPRESSION_GROUP3_1D );
    System.out.println( encodeParam.getCompression() );
    // Set parameters from command line arguments.
    String inFile1 = "04ea50b9.r01";
    PlanarImage src01 = loadImage(inFile1);
    // Create the source op image.
    FileOutputStream out1 = createOutputStream("out1.tif");
    encodeImage(src01, out1);
    PlanarImage src1 = loadImage( "out1.tif" );
    // Set parameters from command line arguments.
    /*String inFile2 = "04c9fe8f.r01";
    PlanarImage src02 = loadImage(inFile2);
    // Create the source op image.
    FileOutputStream out2 = createOutputStream("out2.tif");
    encodeImage(src02, out2);
    PlanarImage src2 = loadImage( "out2.tif" );*/
    setLayout(new GridLayout(2, 2));
    ScrollingImagePanel panel1 = new ScrollingImagePanel(src1, 512, 400);
    //ScrollingImagePanel panel2 = new ScrollingImagePanel(src2, 512, 400);
    Frame window = new Frame("JAI Sample Program");
    window.add(panel1);
    //window.add(panel2);
    window.pack();
    window.show();
    It gives the following error:
    Exception in thread "main" java.lang.NullPointerException
    at TIFFTrial.<init>(TIFFTrial.java:57)
    at TIFFTrial.main(TIFFTrial.java:16)

    You need to initialise encodeParam.

  • Jpeg Compressed Tiff images

    I am trying to open TIFF files that have Jpeg compression but QT does not support this combo. These have become very standard in the document storage world as type of thumbnail/baby image. Anyone know how to get in contact with someone at Apple to see if they can add this capability? You can view plain jpg and tiff files with QT but not the Jpeg compressed TIFFs.
    Mark

    Can you please post the code that you are using? com.sun.media.jai.codec.TIFFDecodeParam --> this can help you out.

  • How to load compressed tiff image formats with JIMI

    this method
    Image image=image = Jimi.getImage(imgResource);returns incorrect Image width & height (-1) for TIFF compressed formats.
    is there any jimi example showing how to properly load the tiff compressed image ?
    thanks.

    Wild guess: how old is JIMI technology? Has it been
    kept uptodate, or has
    it been abandoned? And is LZW compression in TIFF
    format a more recent feature?yes i checked jimi docs and here is what they say :
    TIFF      
    * Bi-level / Greyscale / Palette / True Color images
    * Uncompressed images
    * CCITT compressed Bi-level images with CCITT RLE, CCITT Group 3 1D Fax, CCITT Group 3 2D Fax, CCITT Group 4 Fax, CCITT Class F Fax
    * Packbits compressed images
    * LZW Compressed images
    * Tiled TIFF files
    * Handles all values of Orientation
    * TIFF / JPG compression variant
    * any color space except RGB
    * True Color images not of Red/Green/Blue format

  • Jpeg compression for tiff image (nt gettin a view of jpeg compressd pages)

    Hi All,
    I have a problem of jpeg compression inside a tiff file. When I convert no. of pages in a multi-page tiff file I m not getting a view of jpeg compressed pages. I convert black and white as well as gray scale jpeg images inside the tiff file. I used Compression Group4 for black and white image and JPEG compression for gray scale image. Also set the dpi of each page. But most of the viewer doesn’t support my jpeg compressed pages. When I set the quality of jpeg images to 0.1f that time I m getting a view of particular images for some image viewer.
    My requirement is to show the jpeg compressed image inside the IMAGING PREVIEW 2.5 VERSION. But it doesn’t support for my output tiff. As well as cant get properties of that page inside the Fax viewer except Resolution 200x200 dpi.
         If anybody has any idea to compressed jpeg image inside the tiff file, please tell me how I can compress the gray scale image using jpeg compression.
    Thank you in advance
    Dipak

    Hi Maxideon,
    Thank u 4 ur immediate reply. But my requirement is, to show d tiff file only in IMAGING PREVIEW 2.5 VERSION. I tried lots but didn’t manage to get a view of JPEG compressed page. I think somewhere I m doin wrong. Somewhere I wrote wrong code, cause d properties of jpeg compressd images also not getting in Fax Viewer except DPI. I change the BaselineTIFF Tags of JPEG compressed image, but can’t manage output yet. I think d problem create at d time of metadata writing. My problem is tht, tiff created using sum other soft. is suppported by IMAGING PREVIEW 2.5 VERSION, y nt mine?
    Here is my code for BaselineTIFFTagSet:
    if(isBinaryImage) {
                 // resolution unit
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(296), 2));
                 // bit per sample
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(258), 1));
                 // compression
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(259), 4));
                 // rows per strip
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(278), bImageImage.getHeight()));
            } else {
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(296), 2));
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(258), 8));
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(259), 7));
                 // thresholding
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(263), 3));
                 rootTiffIFD.addTIFFField(new TIFFField(base.getTag(278), bImageImage.getHeight()));
            }     If u have any idea 4 write a metadata of jpeg page wid jpeg compression, can u plz suggest me hw to write a metadata 4 jpeg image? Which Baseline Tags r needed to set d jpeg compression?
    Thank you
    -dipak

  • Tiff image with JPEG compression

    How does photoshop handle RGB and YCbCr as photometric interpretations of tiff image with JPEG compression?
    Are they same?

    Got no idea but here is a website with a adobe pdf answer.
    http://www.ask.com/web?q=How+does+photoshop+handle+RGB+and+YCbCr+as+photometric+interpreta tions+of+tiff+image+with+JPEG+compression%3F&search=&qsrc=0&o=0&l=dir

  • How do I Convert a  Tiff image to a jpeg without being FORCED to 8-bit Color?

    I am an Artist.  I have High quality TIFF images.  When I convert the tiffs to jpeg it forces me into 8-bit color automatically. (Forget about 32bit - it will not allow me to jpeg that at all)   The only way I can get back to 16bit color is to use the already SMAshed file and bring it up to 16bit.  THIS makes NO sense.  Once the jpeg is smashed, HOw in the world is it supposed to convert up again. ??  Then even though it says you converted the file to 16 -bit , the metadata refers still to the file as 8-bit.
    On top of all of that confusion, One picture, for example, when supposedly converted to 16bit,  gets much BRighter then even the original Tiff image.  It looks good on one hand and over exposed on the other.  I assume that is photoshop throwing in fake resolution, am I right?
    Am I wasting my time with this imaginary 16bit conversion?
    Is there ANY way to take that original Tiff image and convert it to 16bit jpeg without the Default 8bit?  I have been trying all kinds of things.  I even have asked my web guy.  My web guy says that 8-bit is unexceptable for printing, even for web.
    Could this have anything to do with my computer and scanner?
    I have the iMAC OS X 10.8.3 (3.2 GHz) 8 GB memory.
    And I also have an Epson Expression 10000XL graphic arts scanner capable of scanniing at 48bit color.
    This color stuff Really matters!  It MATTERS!  I HAve FINE art files.  I am already losing so much quality with the jpeg conversion. (which I am required to do for SmugMug, in addition to compressing all my files to 50mb or Under)
    Anyone who knows anything that could help me would be much appreciated. 
    Aloha,
    -Melissa

    First of all jpeg is 8 bit only there is no way to save as a 16 or 32 bit jpg, just does not exist. Secondly people print in 8 bit all the time and most if not all web graphics are in 8 bit as that is the only way to view it as there is no 16 bit or 32 bit monitors to view it. All but a few pro monitors are 8 bit monitors.
    If you care about the color gamut and want the full range of color that 16 and 32 bit provide, then why jpg? Jpg by its own nature throws out color just to compress, thats why it is popular on the web, because of its small file size not its quality. If you need 16 or 32 bit for anything it must be in a format that supports that color depth.
    That being said a jpg image at 8 bit will display 16+ million colors,  256 shades of red, 256 shades of green and 256 shades of blue.
    Now here is where I think your bit information is off. a jpg image is a 24 bit image that will produce 8 bits of red, 8 bits of green and 8 bits of blue.
    The 8, 16 and 32 are per channel not total color information.
    If the overall image was 8 bits, the image would be gayscale.

  • Displaying TIFF images in Oracle Forms 6i

    Hello, friends!
    I am working in Oracle Forms 6.0.8 (that ancient tool) and encounter a problem with displaying TIFF images.
    I have a number of scanned images and some of them are displayed and some are not. I've tried both extracting them from the database or from the file system (using READ_IMAGE_FILE). Sometimes I am getting just blank field in my image item and sometimes (after using READ_IMAGE_FILE) I get the error FRM-47100 (cannot read image file). Of course I've checked that all the files are displayed using standard tools for displaying TIFFs.
    Basically the question is what kind of TIFF is considered valid and readable by Oracle Forms.
    Analyzing TIFF tags actually gave me nothing: I have a pair of files with tags different only in image width/length and a number of rows/strip (but even those values are close), and one of the file is displayed correctly while the other is not. The thing I noticed is that invalid files are using compression type of CCITT Group 4.
    Possibly Oracle Forms follows TIFF specification only to certain extent and does not support all the extensions, while sometimes the problems are not visible to user.
    As a result of my work I need some automatic tool that converts undisplayable TIFF files to displayable ones but firstly I am to determine where the problem is. And it would be very good to have a prooflink that approves my decision.
    Looking forward to any help! Thanks in advance.

    Thanks to everybody, but I'm afraid my files don't contain any EXIF tags (although TIFF seems to support them). The file doesn't contain any tags with IDs greater than 0x7FFF but only core TIFF tags (with IDs of lower numbers). Moreover I have a file with exactly the same set of tags (but the values are a bit different) which is displayed properly.
    I've shared the issued file (nondisplayable) on the following link: [https://rapidshare.com/files/3137807470/2.tif]
    If anyone could tell me why isn't it displayed in Forms I would be very grateful.

  • TIFF images in PDF documents

    Just looking for a short answer, no technical details needed: Is it possible to store TIFF images in PDF documents without losing information?
    Thank you in advance,
    k.

    >On my own computer it seems I only have options to save it as jpg or zip internally.
    That's correct. The PDF specification supports many more forms of
    compression. Than this.
    > Can't find any options to save it as TIFF internally.
    That's correct. A PDF image is stored as a collection of pixels NOT as
    an embedded graphic format.
    The collection of pixels may be compressed according to one of many
    compression schemes. There is JPEG (internally called DCTDecode) and
    ZIP (internally called FlateDecode). FlateDecode is completely
    lossless, so if what you are concerned about is loss of picture
    quality, this is the one to use.
    A ZIP compressed PDF is typically going to be about the same size as
    the corresponding ZIP compressed TIFF.
    Aandi Inston

  • File Out Tiff Image Sequence

    Hello! Can anyone recommend/explain the correct settings in the File Out node to output a TIFF Image Sequence?
    Thanks!

    Wow, I just figured out the Shake problem. First off you are right, my "black background" is an alpha mask. But why is it there?!? It is a "bug" in Shake:
    FileOut - Quicktime Movie - Animation - Options - Compression Settings - "MillionsofColors" - Okay
    Now, when I reopen the FileOut node to double check my Compression Settings, it has defaulted BACK to "MillionsofColors+" So yeah, "MillionsofColors" should result in an alpha-free export BUT SHAKE WILL NOT RETAIN A SELECTION OF ANYTHING OTHER THAN "MillionsofColors+" I tried setting it to "Black and White," "ThousandsofColors" - same issue - the export still has an alpha because Shake took the Compression Setting back to "MillionsofColors+"
    So thanks for all your help on this, I'm glad your system is not operating with this quirk.
    I'm pretty sure I hate Shake.

  • Displaying Tiff Image on browser

    Hi friends ,
    I want to display tiff image on browser . For that i have written one servlet witch will desplay tiff image on browser
    Here i am sending my code snippets for servlet.
    Here file is source file which i want to display.
    FileSeekableStream ss = new FileSeekableStream(file);
              ImageDecoder tiffDecoder= ImageCodec.createImageDecoder("tiff", ss, null);;
              p = tiffDecoder.getNumPages();
              for(int x=0;x<p;x++){
              RenderedImage tiffPage = tiffDecoder.decodeAsRenderedImage(x);
              ByteArrayOutputStream stream = new ByteArrayOutputStream();
         TIFFEncodeParam tiffOptions = new TIFFEncodeParam();
         // You may want to set compression or tile attributes on the     EncodeParam here
         RenderedOp l_return = JAI.create("encode", tiffPage, stream,"TIFF", tiffOptions);
         bt = stream.toByteArray();
    then writing this byte array(bt)
    OutputStream out;
    out.write(bt);
    and responce .setContentType("image/tiff");
    i also want to know whether mime type image/tiff is supported or not in servlet.
    When i run servlet i am getting File Downloading dialog box.
    also when i download image file it's size is very large than original.
    Plz correct my code.It's verry urgent.
    Thanks in Advance

    hi, could you post the solution?
    I'm looking forward to know the solution.
    Thanks

  • 16 Bit Tiff Images Display Bug?

    Question 1:
    Is there a problem with Aperture 2.0 displaying 100 + mb 16 bit tiff images generated by a film scanner (nikon coolscan 4000 ed)? I am having trouble with my library that I migrated from Aperture 1.5. All of my images were working fine in Aperture 1.5 (and previously in iPhoto as far back as 2003). In Aperture 2.0 I am getting scrambled images and some images that read unsupported file format. The problem is sporadic. It effects some images and not others. Sometime images display correctly and sometime they become scrambled and unsupported, and then back again.
    There is no trouble with the images themselves. I export them to CS3 with no distortion or trouble. The problem seems to be in Aperture 2.0.
    I have re-built the library, tried migrating images, changed the color profile.... I think I have exhausted every trick I can manage from a user vantage point. The images work fine when converted to 8 bit files. This is not the solution for me - I need to keep these images 16 bit.
    Question: Is this this just my version (I purchased downloaded upgrade), that is having trouble, or is this a wider problem that Apple aware of and is looking into?
    Please advise. I have 1000's of scanned pictures that I have been working with for years that were fine and now are not. I purchased a new Mac Pro 2.8 so as to work more productively with these large images - and now it seems that the very software I rely on has failed me.
    I have not been able to find any comments from Apple regarding this issue.

    I've had this problem with images saved as 8-bit scans.
    Are you using any compression in the TIFs? I scanned using Nikon Scan 4, cleaned up a bit in Photoshop 7, reduced the bit depth to 8-bit, and saved at TIFs with embedded colour profile using ZIP compression, Macintosh byte order.
    This used to work with Aperture 1.5.6, but with Aperture 2.0 I see a kind of offset pattern, so a vertical line looks like this:
    If export the master TIF, open it in Photoshop (where it looks normal) and save it with no compression Aperture displays it properly.
    (I'm still using Tiger, so I don't think this is an OS issue.)

  • TIFF Images Rendering

    I imported a TIFF image into an FCE project. The image has text in it (as in drawings of texts). Using the Motion tab, I have the image moving in a of scrolling manner. However, even when this project is rendered and exported to decent quality, the text in the image is very jittery like and not smooth at all. I don't have the scrolling really moving all that fast at all.
    I used TIFF because it is Apple native. Should there be another image type I use? When I made the TIFF image I saved it with no compression and the layers of the image project were 'merged' rather than 'flattened'.
    Anyone else experience this issue or know the solution.
    Thanks

    Why don't you use Title Crawl in FCE?
    Please give exact details of the image, its size, resolution, color space, also the contents, colors, fonts, sizes, anything else. Maybe a screen shot of possible.

  • Saving a tiff image N preserviing its resolution

    hi guys ,
    I am facing a problem saving an existing tiff file to a tiff format.
    My original image is of 600 dpi both horizontal and vertical resolution.
    When i save using my patch of code the resulting image is 96dpi in resolution.
    I need to make sure taht there is no loss when i am saving my image
    public void saveImage()
         File file3; // The file that the user wants to save.
    JFileChooser fd; // File dialog that lets the user specify the file.
    fd = new JFileChooser(".");
    fd.setDialogTitle("Save Image As TIFF...");
    int action = fd.showSaveDialog(this);
    if (action != JFileChooser.APPROVE_OPTION) {
    return;
    file3 = fd.getSelectedFile();
    if (file3.exists()) {
    // If file already exists, ask before replacing it.
    action = JOptionPane.showConfirmDialog(this,
    "Replace existing file?");
    if (action != JOptionPane.YES_OPTION)
    return;
    try {
    FileOutputStream os = new FileOutputStream(file3);
    TIFFEncodeParam param1 = new TIFFEncodeParam();// USE WHEN CONVERTING TO TIFF FILE
    if(factor.isBinary())
         //param1.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4); //USE IF BINARY IMAGE
         param1.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
         //param1.setCompression(TIFFEncodeParam.COMPRESSION_NONE);//USE IF BINARY IMAGE
         //param1.setCompression(TIFFEncodeParam.COMPRESSION_LZW); //USE IF BINARY IMAGE
    else
         param1.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
         //param1.setCompression(TIFFEncodeParam.COMPRESSION_NONE);
    ImageEncoder enc =ImageCodec.createImageEncoder("TIFF",os,param1);
    //enc.encode(source);
    enc.encode(backup);
    os.flush();
    os.close();
    catch (IOException e)
                   // Some error has occurred while trying to write.
                   //Show an error message.
                   JOptionPane.showMessageDialog(this,
                                  "Sorry, an error has occurred:\n" + e.getMessage());
    Any suggestions ?
    Aadil

    Hi,
    Could you find any method to change the tiff image compression or even resolution.
    When i try this,
    String filename="c:\\sample1.tif";      
              File file = new File(filename);
         SeekableStream s = new FileSeekableStream(file);
         ImageDecoder dec = ImageCodec.createImageDecoder("TIFF", s, null);
         //RenderedImage op = new NullOpImage(dec.decodeAsRenderedImage(), null,null, OpImage.OP_COMPUTE_BOUND);
         RenderedImage op = new NullOpImage(dec.decodeAsRenderedImage(0),null,null,OpImage.OP_IO_BOUND);
         ByteArrayOutputStream output = new ByteArrayOutputStream();
         TIFFEncodeParam tp=new TIFFEncodeParam();
         tp.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
         //tp.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_2D);
         ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", output, tp);
         encoder.encode(op);
         encoder.setParam(tp);
         System.out.println(tp.getCompression());
         byte compressedData[] = output.toByteArray();
         FileOutputStream fouts=new FileOutputStream("c:\\sample2.tif");
         fouts.write(compressedData);
         output.close();
         fouts.close();
    It's giving errro saying that "End of data reached before next EOL encountered" when i call encoder.encode(op);
    method..
    any suggestions?????

  • Stamping tiff images

    Hello,
    I'm looking for a way in Java to stamp tiff images. The images have the following criteria: format A4, single page, black and white, g4 compressed, single strip offset. A formatted number has to be added in the right upper corner of each image.
    Could somebody give me a clue please how I can create a tiff-image from a String/a number and merge this image with the original image? I'm searching for an hour now but obviously I don't know the right key-words.
    Thank you!
    wowasa

    Hi, I just unchecked the Object Level Display and nothing happened.
    Nothing has changed with the images at all. The only thing that is different is that I created the manuscript in a trial version of the software. Maybe it was an earlier version than the software I purchased? Would that have an effect on the images? I didn't purchase the software directly from the trial version I used. What happened is that the trial version expired. Then a month later or so I bought a new laptop, bought the Creative Suite (Education version, so much cheaper than normal), and then installed the software on the laptop. Then I opened my manuscript using the new software, the CS5.5, and everything was fine except for the images being blurry.
    Is it possible I used a trial version in CS5.0 and then bought CS5.5 and that has something to do with it?
    Thanks for all of your help!!
    I just realized I wasn't logged in & that's why I couldn't reply.
    Message was edited by: patawhateverly

Maybe you are looking for

  • Modeling a boolean value in an Oracle database

    I want to use a boolean type in my XML schema and need to know how best to map that to the database. I tried using a string, but I get an error in the update map for that. Any advice? Thanks, Jeff

  • Burning a project to DVD

    I am getting an error message at 99% complete of burning a DVD.  The message says "INTERNAL SOFTWARE ERROR: %0, line %1"  What does this mean?

  • Automatically turn filters on or off at a scheduled time

    Hi there, Is it possible for a Blackberry (I have a 9780)  to automatically turn email filters on or off at a scheduled time during night?  This is to allow alerting notification start without me having to manually do it.  (I'll be asleep ) (I want t

  • Cannot activate CS4 serial number

    Is anyone else having problems with activating CS4 serial number. I bought a student version of CS4 recieved my serial number after verifying student status, upon entering the serial number it was rejected, I tried unistalling the application and rei

  • Dual External Drive Issue

    I have two WD Passport drives. One serves as my Time Machine back up drive and the other for my iPhote and iTunes library. My issue is that when I plug both of them into the USB ports, my Macbook Pro only recognizes one of them. Why? I can only think