JAI TIFF

I'm trying to convert a PDF to TIFF.
This part works fine, but the size of the TIFF worries me however.
The PDF's i'm converting have a size of 4 kb, and the TIFF outputs to almost 3 mb.
How do i get around this problem? Can i compress the TIFF in anyway?
I tried to scale down the TIFF and got it down to a size of 180 kb, but then the picture is blurry and impossible to read!
Thanks!

You need to compress.
http://java.sun.com/products/java-media/jai/forDevelopers/jai-imageio-1_0_01-fcs-docs/com/sun/media/imageio/plugins/tiff/TIFFImageWriteParam.html
         TIFFEncodeParam params = new TIFFEncodeParam();
         params.setCompression( TIFFEncodeParam.COMPRESSION_PACKBITS );
         ImageEncoder encoder = ImageCodec.createImageEncoder( "TIFF", fos, params );
         if( encoder == null ) {
              throw new InstantiationException( "No TIFF encoder" );
         encoder.encode( image );  

Similar Messages

  • JAI TIFF - JPEG colour problem

    Hi all...
    I want to use JAI to convert from TIFF to JPEG. Here is my test program:
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    import java.awt.image.renderable.ParameterBlock;
    public class Test {
         public static void main( String[] args ) {
              String srcFile = args[0];
              String dstFile = args[1];
              RenderedOp op = JAI.create( "fileload", srcFile );
              ParameterBlock p = new ParameterBlock()
                        .addSource( op )
                        .add( dstFile )
                        .add( "JPEG" );
              RenderedOp saveOp = JAI.create( "filestore", p );
    }It works fine, except the colours in the output are all wrong.
    After running
    java Test NEC_LCD3000+Soundb_R.tif bad.jpg
    my output looks like
    http://xtuml.jdns.org/bad.jpg (if you can even see it. Firefox refuses to display the image. Gimp and KView can open it though, but all the colours are messed up)
    The output should look like
    http://xtuml.jdns.org/good.jpg
    The original was ripped from NEC's website:
    http://www.nec-display-solutions.com/coremedia/download/18634/LCD3000-ProductPicture-Soundbar-Side-R-TIF.zip
    I suspect it's a problem to do with Color Models or something, but I'm way out of my depth in this area.
    Can anybody suggest a solution?
    Thanks in advance!
    Regards,
    James

    Maybe this is the problem... the original image has an alpha channel. When I used the GIMP to flatten it back to RGB (with no alpha channel), JAI works fine...
    Does JAI support RGBA? Am I posting in the wrong forum? Is the whole world against me? :P

  • JAI TIFF Encoding Problem

    I'm evaluating the Gnome Java Twain package for scanning an image using an Applet as an interface. The image scans in fine and is displayed ok. When I attempt to write it however, using JAI, it creates a 1 byte bad .tif, crashes the browser and places a message file on the desktop that includes the text:
         Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d44309d
         Function name=(N/A)
         Library=C:\PROGRA~1\JavaSoft\JRE\1379A4~1.1\bin\hotspot\jvm.dll
         NOTE: We are unable to locate the function name symbol for the error
         just occurred. Please refer to release documentation for possible
         reason and solutions.
         # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
         # Error ID : 4F530E43505002C4
         # Please report this error at
         # http://java.sun.com/cgi-bin/bugreport.cgi
         # Java VM: Java HotSpot(TM) Client VM (1.3.1_01 mixed mode)
    I'm using version 1.3.1_01 JRE with the 1_1_1_01 of the JAI. The policy file is set up to
    give permission to the Applet.
    Below is some code. I saw various examples do it this way, however, it
    doesn't seem to work for me. Any ideas would be appreciated. Thanks.
    try {
    Twain twain = new Twain();
    awtImage = Toolkit.getDefaultToolkit().createImage(twain);
    MediaTracker tracker=new MediaTracker(this);
    tracker.addImage(awtImage, 0);
    try     {
    tracker.waitForAll(0);          
    catch (InterruptedException e)
         throw new Exception (e.toString());                
    twain.close();
    RenderedOp scannedImage = (RenderedOp) JAI.create("AWTImage", awtImage);
    File file = new File(myFileName);
    FileOutputStream os = new FileOutputStream(file);           
    TIFFEncodeParam params = new TIFFEncodeParam();
    params.setCompression(TIFFEncodeParam.COMPRESSION_NONE);
    ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", os, params);
    if(encoder == null) {
    System.out.println("imageEncoder is null");
    else {
    encoder.encode(scannedImage); //crashes browser and causes JVM error     
    os.close();
    } catch ....     

    The Java Twain package has been updated since, the name has changed to Morena. Now Morena is available at http://www.gnome.sk together with a tutorial and many examples.
    For illustration:
    Using Morena, pictures from the scanner/camera are acquired in the same way as a file is opened from the disk:
    image=Toolkit.getDefaultToolkit().createImage(TwainManager.getDefaultSource());
    There are more than 100 methods available in the Morena to get and set scanner capabilities. Below is an example how to call some typical of them:
    TwainSource twainSource= TwainManager.getDefaultSource();
    twainSource.setVisible(false);     // hiding the Twain user interface and manage scanning directly from the Java
    twainSource.setXResolution(100);     // setting DPI
    twainSource.setYResolution(100);     // setting DPI
    twainSource.setPixelType(TwainSource.TWPT_ RGB);     // setting color model
    System.err.println("getPixelType=" + source.getPixelType()); //geting the actual color model
    twainSource.setContrast(300);     // setting contrast
    image=Toolkit.getDefaultToolkit().createImage(twainSource);
    To analyze an acquired image is a straightforward method. The developer needs to create his own class with a Java ImageConsumer interface and to start produce data from the scanner/camera directly to the new class. E.g. if his class has name "myImageConsumer", it receives data by the following code:
    TwainSource twainSource= TwainManager.getDefaultSource();
    twainSource.startProduction(myImageConsumer);
    Data are sent via ImageConsumer interface and can be parsed in the byte/int array.

  • Impossible to save an image in applet?

    I have been working on saving an image in Java applet for a week. But I failed to generate new image file on the disk. I'm using Java SDK1.4.0_03 and JAI 1_1_1_01. I found a topic "JAI TIFF Encoding Problem" mentioned that it should give permission to the Applet. I'm wondering if my problem is caused by the permission of Applet. But how to change the permissio of Applet? Otherwise is it impossible to save the image in Applet? Thanks your replay.

    Re : Thanks your replay.
    I have been working on saving an image in Java applet
    for a week. But I failed to generate new image file on
    the disk. I'm using Java SDK1.4.0_03 and JAI 1_1_1_01.
    I found a topic "JAI TIFF Encoding Problem" mentioned
    that it should give permission to the Applet. I'm
    wondering if my problem is caused by the permission of
    Applet. But how to change the permissio of Applet?
    Otherwise is it impossible to save the image in
    Applet? Thanks your replay. You're welcome :)

  • How to retain the same resolution while croping a tiff image using jai api

    Hi all,
    I have designed a program to crop a tiff image.But after croping the tiff,the resultant file resolution is not the same as the original source file.
    In the program,the source file Nadeshiko_v1_02.tif has the resolution(X) of 1200 DPI and resolution(Y) has 1200 DPI pixels.
    But after croping the resolution of output file is 100 DPI.
    Please give me some idea on how to retain the same resolution.
    <code>
    package jai;
    import java.awt.Frame;
    import java.awt.image.RenderedImage;
    import java.awt.image.renderable.ParameterBlock;
    import java.awt.image.renderable.RenderableImage;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import javax.imageio.*;
    import javax.imageio.stream.ImageOutputStream;
    import javax.media.jai.Interpolation;
    import javax.media.*;
    import javax.media.jai.JAI;
    import javax.media.jai.PlanarImage;
    import javax.media.jai.RenderedOp;
    import javax.media.jai.widget.ScrollingImagePanel;
    import com.sun.media.jai.codec.FileSeekableStream;
    import com.sun.media.jai.codec.SeekableStream;
    import com.sun.media.jai.codec.TIFFEncodeParam;
    import javax.media.jai.OperationDescriptorImpl;
    import java.io.*;
    import java.util.Iterator;
    import javax.media.jai.operator.*;
    // import javax.media.jai.widget.ScrollingImagePanel;
    public class crop {
              /** The main method. */
    public static void main(String[] args) {
    /* Validate input. */
    /* if (args.length != 1) {
    System.out.println("Usage: java JAISampleProgram " +
    "input_image_filename");
    // System.exit(-1);
    float a=(float) 70.3;
    float b=(float) 70.4;
    float c=(float) 3100.3;
    float d=(float) 5522.4;
    * Create an input stream from the specified file name
    * to be used with the file decoding operator.
    String TIFF="TIFF";
    FileSeekableStream stream = null;
    try {
         stream = new FileSeekableStream("D:\\tif images\\Nadeshiko_v1_02.tif");
    // stream = new FileSeekableStream("D:\\tif images\\Nadeshiko_v1_01.jpg");
    } catch (IOException e) {
    e.printStackTrace();
    System.exit(0);
    // Load the source image from a Stream.
    RenderedImage im = JAI.create("stream", stream);
    RenderedImage image2= CropDescriptor.create(im, a, b, c, d, null);
    ScrollingImagePanel panel = new ScrollingImagePanel(image2, 100, 100);
    // Create a frame to contain the panel.
    Frame window = new Frame("JAI Image Cropping");
    window.add(panel);
    window.pack();
    // window.show();
    // Define the source and destination file names.
    // String inputFile = "D:\\tif images\\Nadeshiko_v1_05.tif";
    String outputFile = "D:\\tif images\\Nadeshiko_v1_04.tif";
    // Save the image on a file. We cannot just store it, we must set the image encoding parameters
    // to ensure that it will be stored as a tiled image.
    TIFFEncodeParam tep = new TIFFEncodeParam();
    tep.setWriteTiled(true);
    tep.setTileSize(80,80);
    JAI.create("filestore",image2,outputFile,"TIFF",null);
    try {
                   stream.close();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    </code>
    Thanks,
    Sanat Meher

    Try the following,
    TIFFEncodeParam tep = new TIFFEncodeParam();
    // Create {X,Y}Resolution fields.
    TIFFField fieldXRes = new TIFFField(0x11A, TIFFField.TIFF_RATIONAL,
                                        1, new long[][] {{DPI_X, 1}});
    TIFFField fieldYRes = new TIFFField(0x11B, TIFFField.TIFF_RATIONAL,
                                        1, new long[][] {{DPI_Y, 1}});
    tep.setExtraFields(new TIFFField[] {fieldXRes, fieldYRes});

  • JAI create TIFF Compressed in Group 3 Fax

    Hi people,
    I have a problem regarding a tiff image. I need to create a compressed Group 3 Fax tiff file. I am using JAI, and I cannot find a way to compress it as a Group 3 Fax. When I use TIFFEncodeParam.COMPRESSION_GROUP3_1D, the file is being compressed as CCITT Modifed Huffman RLE, and when I use TIFFEncodeParam.COMPRESSION_GROUP3_2D, the file is being compressed as TIFF Bitmap (TIF) Group 3 Fax 2D.
    My requirements are to create a compressed TIFF Bitmap (TIF) Group 3 Fax. Do you have any ideas?
    Regards
    George Azzopardi

    Hi people,
    I have a problem regarding a tiff image. I need to create a compressed Group 3 Fax tiff file. I am using JAI, and I cannot find a way to compress it as a Group 3 Fax. When I use TIFFEncodeParam.COMPRESSION_GROUP3_1D, the file is being compressed as CCITT Modifed Huffman RLE, and when I use TIFFEncodeParam.COMPRESSION_GROUP3_2D, the file is being compressed as TIFF Bitmap (TIF) Group 3 Fax 2D.
    My requirements are to create a compressed TIFF Bitmap (TIF) Group 3 Fax. Do you have any ideas?
    Regards
    George Azzopardi

  • JAI Multiple page Tiff's into one multiple page tiff

    Please helpppppppppppppppppppppppppppppppppppppppp
    I have been hammering on jai.create and other stuff and can't get this to run. I am trying to merge two multiple-page tiff's into one big multiple page tiff and it only picks up first page each from both the files !!!
    so if i have a 3-page tiff and a 4-page tiff...it will pick up first page from both the files. Im releatively new to java but have spent a couple of days on this already.
    the following is my program.
    import com.sun.media.jai.codec.*;
    import java.awt.image.RenderedImage;
    import java.awt.image.renderable.ParameterBlock;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.Vector;
    import javax.media.jai.JAI;
    import javax.media.jai.RenderedOp;
    import java.util.*;
    public class MultiTiff {
    /** Creates a new instance of Class */
    public MultiTiff() {
    public static void main(String args[]) {
    String outFile = "C:\\test23.tif";
    String[] inFiles = new String[2];
    inFiles[0] = "C:\\C.TIF";
    inFiles[1] = "C:\\B.TIF";
    createMultitiff(inFiles , outFile);
    public static void createMultitiff(String[] fileNames, String outName) {
    RenderedImage[] srcs = new RenderedImage[fileNames.length];
    ParameterBlock pb = (new ParameterBlock());
    pb.add(fileNames[0]);
    RenderedImage src0 = JAI.create("tiff",fileNames[0]);
    ArrayList list = new ArrayList(srcs.length - 1);
    for(int i = 1; i < srcs.length; i++) {
    pb = (new ParameterBlock());
    pb.add(fileNames);
    list.add(JAI.create("fileload", pb));
    TIFFEncodeParam param = new TIFFEncodeParam();
    param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    param.setExtraImages(list.iterator());
    pb = (new ParameterBlock());
    pb.addSource(src0);
    pb.add(outName).add("tiff").add(param);
    JAI.create("filestore",pb);

    Hi Sandra,
    You have ExportPDF subscription from Adobe which would not combine files for you. It is only used to convert PDF into different formats.
    For Combining PDF you might to purchase the different subscription : PDF Pack
    Let me know if you have any other question
    Regards,
    ~Pranav

  • Open Tiff, rotate, resize and save as JPEG (using JAI)

    I 'm having a hard time getting my arms around the JAI classes to perform
    this transform. I've looked at the tutorial and api, etc and did not get
    very far.
    I have the code to open the TIFF, and save as a JPEG. My question is how to
    go from there to do the manipulations (rotate, resize)?
    If anyone knows how to do this with JAI classes, please let me know.
    Thanks,
    Bill Pfeiffer
    My code:
    try
    SeekableStream input = new FileSeekableStream("C:\\S1000000.TIF");
    FileOutputStream output = new FileOutputStream
    ("C:\\S1000000.jpg");
    TIFFDecodeParam TIFFparam = new TIFFDecodeParam();
    ImageDecoder decoder = ImageCodec.createImageDecoder("tiff",
    input ,TIFFparam);
    JPEGEncodeParam JPEGparam = new
    JPEGEncodeParam();
    ImageEncoder encoder = ImageCodec.createImageEncoder
    ("jpeg",output,JPEGparam);
    RenderedImage ri = decoder.decodeAsRenderedImage();
    encoder.encode(ri);
    input.close();
    output.close();
    catch (IOException e)
    e.printStackTrace();

    For Rotation....
    1) add the following function to your code.
    private RenderedImage rotate(int degrees, RenderedImage src, Interpolation interpRotate) {          
                             try {               
                                       float radians = (float)(degrees * (Math.PI/180.0F));
                                       ParameterBlock pb = new ParameterBlock();
                                       pb.addSource(src);
                                       pb.add(0.0F);
                                       pb.add(0.0F);
                                       pb.add(radians);
                                       pb.add(interpRotate);
                                       src = (RenderedImage)JAI.create("rotate", pb, null);
                                       pb = new ParameterBlock();
                                       pb.addSource(src);
                                       pb.add((float)-(src.getMinX()));
                                       pb.add((float)-(src.getMinY()));
                                       pb.add(interpRotate);
                                       return (RenderedImage)JAI.create("translate", pb, null);
                             }catch (Exception e) {               
                                       return src;
    2. call this function before the "encoder.encode(ri);" line in your code. I pass "new InterpolationBilinear()" for the interpolation parameter of the function.
    For scaling...
    1) add the following lines to your code after or before you rotate the image.
    ParameterBlock pb = new ParameterBlock();
    pb.addSource(ri);
    pb.add(1.1F); //play with these 4 lines to make the image bigger or smaller (1.0F is actual size)
    pb.add(1.1F);
    pb.add(0.0F);               
    pb.add(0.0F);               
    pb.add(new InterpolationNearest() );
    t = (RenderedImage) JAI.create("scale",pb,null);
    hope this helps. Just play with it a bit. You'll get it.

  • [JAI IMAGEIO] TIFF to JPEG Loss DPI, HOW TO?

    Hi!
    I tried to convert a tiff image to jpeg with the same dpi resolution but i don't know how to make it or if i'm on the right way.
    Here is my code.
    Thanks for your help!
    public static void convertFromTifToJpgPrim(String sSourceFileName, String sTargetFileName) throws CoinDatabaseLoadException, SQLException, NamingException{
    try
    RenderedOp renderedOPCrop = JAI.create("fileload", sSourceFileName);
    RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
    RenderedOp renderedOPScale = JAI.create("SubsampleAverage",
    renderedOPCrop,
    new Double((double)0.5),
    new Double((double)0.5),
    qualityHints);
    JPEGEncodeParam jpgparam = new JPEGEncodeParam();
    jpgparam.setQuality(1f);
    FileOutputStream fs = new FileOutputStream(sTargetFileName);
    ImageEncoder enc = ImageCodec.createImageEncoder("jpeg", fs, jpgparam);
    enc.encode(renderedOPScale);
    fs.flush();
    fs.close();
    catch(Exception e)
    e.printStackTrace();
    }Regards,
    Julien

    I don’t see much difference in the side-by-side thumbnails.  The JPG’s histogram (right one) has a little more black bunched up on the lefthand end and the histogram is vertically scaled to make that higher peak fit so the entire rest of the histogram is shorter, but the entire JPG’s histogram is not shifted left (toward the dark end) very much at all.  Specifically there is a red peak in between the f/11 and 5.0sec indications on both and the green peak is above the 10mm in both cases.  Converting to sRGB will clip things to fit within the sRGB gamut so some difference is expected, I’m just not seeing very much.  Are you seeing more of a difference in Finder/Preview than with the re-imported JPG in LR?
    You could try exporting your TIF as a ProPhotoRGB JPG and re-import that to compare histograms, since LR’s internal workspace is a wide colorspace like ProPhotoRGB is.
    If you think you have accidentally changed something in your LR preferences, you can exit LR and delete the preferences file (or move it somewhere) then restart LR and let it rebuild a new one.  Before doing this you might want to review your LR preferences in case there’s something important that needs set back.
    http://helpx.adobe.com/lightroom/kb/preference-file-locations-lightroom-4.html

  • TIFF generated with JAI won't fax

    I have tried to generate some simple black/white TIFF files with JAI, which I have then sent to a fax via a tool on an IBM AS/400. The TIFF files look fine on my computer, and the faxing tool also sends them without problems, but the result when the fax machine prints them is just some random pixels in the top of the page.
    I have tried all the fax compatible encodings - COMPRESSION_GROUP3_1D, COMPRESSION_GROUP3_2D and COMPRESSION_GROUP4, with the same result.
    The funny thing is, that if I open one of the generated TIFFs in IrfanView and save it again with the same encoding, the fax machine is able to print it perfectly. So there must be some settings that are changed, which also can be seen by inspecting it with a tool I found called AsTiffTagViewer.
    My original file:
    ImageWidth (1 Long): 300
    ImageLength (1 Long): 300
    BitsPerSample (1 Short): 1
    Compression (1 Short): Group 3 Fax (aka CCITT FAX3)
    Photometric (1 Short): MinIsBlack
    FillOrder (1 Short): Msb2Lsb
    StripOffsets (38 Long): 450, 490, 530, 570, 610, 650, 690, 730, 770,...
    SamplesPerPixel (1 Short): 1
    RowsPerStrip (1 Long): 8
    StripByteCounts (38 Long): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,...
    Group3Options (1 Long): 1
    After being through IrfanView:
    ImageWidth (1 Short): 300
    ImageLength (1 Short): 300
    BitsPerSample (1 Short): 1
    Compression (1 Short): Group 3 Fax (aka CCITT FAX3)
    Photometric (1 Short): MinIsWhite
    FillOrder (1 Short): Msb2Lsb
    StripOffsets (1 Long): 8
    Orientation (1 Short): TopLeft
    SamplesPerPixel (1 Short): 1
    RowsPerStrip (1 Short): 300
    StripByteCounts (1 Long): 1101
    XResolution (1 Rational): 0
    YResolution (1 Rational): 0
    PlanarConfig (1 Short): Contig
    ResolutionUnit (1 Short): Inch
    Software (10 ASCII): IrfanView
    So the question is, whether someone knows which of the tags that are relevant for making it fax-able, as well as how to set them with JAI, which I haven't figured out yet.
    My code:
    //Read PNG file, save as TIFF
    String sourceFile = "jaitest.png";
    PlanarImage image = JAI.create("fileload", sourceFile);
    BufferedImage bi = image.getAsBufferedImage();
    OutputStream os = new FileOutputStream("jaitest.tif");
    TIFFEncodeParam param = new TIFFEncodeParam();
    param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP3_2D);
    ImageEncoder enc = ImageCodec.createImageEncoder("TIFF", os, param);
    enc.encode(bi);
    os.close();

    Problem solved by experimenting. Don't ask me why, but it works when I do this:
    param.setWriteTiled(false);
    param.setTileSize(IMG_WIDTH, IMG_HEIGHT);

  • TIFF - Need to set Whiteiszero (JAI)

    Hi,
    I manipulate images, if it's a RGB picture, I change it to a gray scale and I change it again to a 1-bit pictures (bilevel). When I save this picture to a tiff, JAI set it's Photometric param to Blackiszero but I want to encode my picture with Whiteiszero....
    My compagny use a old tiff viewer, so when I open my encoded file, all pixels are inverted, I really need to set "white is zero" to fix that problem...
    I use this code to convert to a 1-bit
    PlanarImage dst =
    JAI.create("binarize", src, new Double(200));
    And I encode my TIFF with this code:
    int TIFF_PHOTOMETRIC = 262;
    TIFFEncodeParam params = new TIFFEncodeParam();
    params.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    TIFFField[] extras = new TIFFField[4];
    extras[0] = new TIFFField(TIFF_PHOTOMETRIC, TIFFField.TIFF_SHORT, 1, (Object) new char[] {0});
    extras[1] = new TIFFField(TIFF_XRESOLUTION, TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)200, (long)1},{(long)0 ,(long)0}});
    extras[2] = new TIFFField(TIFF_YRESOLUTION, TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)200, (long)1},{(long)0 ,(long)0}});
    extras[3] = new TIFFField(TIFF_RESOLUTION_UNIT, TIFFField.TIFF_SHORT, 1, (Object) new char[] {2});
    params.setExtraFields(extras);
    ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, params);
    encoder.encode(image);

    I found the solutions to force JAI to encode with the tag PhotometricInterpretation set to white is zero.
    Thanks to Klaus Bartz.
    You need a binarized image.
    // Invert the colormodel
    byte[] map = new byte[] {(byte)( 255),(byte)(0)};
    IndexColorModel colorModel = new IndexColorModel(1, 2, map, map, map);
    // Create a bufferedimage with the good colormodel
    BufferedImage bi = new BufferedImage(newImg.getWidth(), newImg.getHeight(), BufferedImage.TYPE_BYTE_BINARY, colorModel);
    bi.setData(newImg.getAsBufferedImage().getData());
    // Invert the image
    DataBufferByte dataBufferByte = (DataBufferByte)bi.getRaster().getDataBuffer();
    byte[] buffer = dataBufferByte.getData();
    for (int lll = 0; lll < buffer.length; lll++) {
    buffer[lll] = (byte)(~buffer[lll]);
    PlanarImage = PlanarImage.wrapRenderedImage(bi);

  • What is MMR Compression? Is it supported for TIFF through JAI

    Please give a brief idea of MMR Compression . I want to compress a TIFF image using MMR compression through JAI , Is it possible?
    If not please suggest alternate methods to compress TIFF using MMR.

    hi,
    I have also same doubt? If anybody knows plz tell me.
    Compression tif file with MMR.

  • Losing Image Information if i save a BufferedImage to TIFF via JAI

    Hi!
    I have a very big problem! When i try to save a BufferedImage via JAI i lose informations about the Height and Width of the Image
    My code:
    pb = new ParameterBlock();
    pb.addSource(bi);
    pb.add("C:\\Programme\\Scan\\" + name + i+ ".tif");                         pb.add("tiff");
    pb.add(null);
    pb.add(null);
    JAI.create("filestore", pb);When i try to read the Image the Height and Width = -1
    But the bufferedImage has got the right value?
    What did i wrong?
    thx

    Soory my fault!
    The picture wasn�t fully loaded!
    SHAME ON ME!!!

  • JAI(Java Advanced Imaging) Problem with splitting TIFF images

    Hi
    I am getting problem with height when I use this program to split TIFF images
    ImageDecoder decImage = ImageCodec.createImageDecoder("tiff", inStr,
    null);
    Then it creates RenderedImage page by page and encodes them to file:
    String outFileName = "";
    OutputStream outStr;
    TIFFEncodeParam encParam = new TIFFEncodeParam();
    encParam.setCompression(TIFFEncodeParam.COMPRESSION_PACKBITS);
    for (int i=0,n=this.getPageCount(); i < n; i++)
    outImage = this.decImage.decodeAsRenderedImage(i);
    outFileName = "C:\\Temp\\Split" + i + ".tif";
    outStr = new FileOutputStream(outFileName);
    BufferedOutputStream bOutStr = new BufferedOutputStream(outStr);
    encImage = ImageCodec.createImageEncoder("tiff",bOutStr,encParam);
    encImage.encode(outImage);
    bOutStr.flush();
    bOutStr.close();
    }The images are shrinking when I split . I need a solution to this problem.
    Thanks for any help in advance
    Sudheer.

    Hi
    Did you get a solution for your problem. I am also trying to split a TIFF file.
    Thanks in advance
    Antony

  • PLEASE HELP - JAI create a tiff file

    Hi people,
    I am trying to reate a TIFF file compressed for a Fax Server. The resolution of such an image must be 200dpi by 100dpi as per server requirements.
    I am managing the create a tiff file with these requirements. However, since I am using a resolution of 200dpi by 100dpi, the final image is squashed vertically. The following is the code which I am using.
    // loading the image
    RenderedImage src = myCreateImage();
    // this is a proprietary method which returns a RenderedImage
    // Specifing the tompression Group
    TIFFEncodeParam param = new TIFFEncodeParam();
    param.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    //set the image resolution to 200 x 100
    TIFFField[] extras = new TIFFField[2];
    extras[0] = new TIFFField(282, TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)200, (long)1},{(long)0 ,(long)0}});
    extras[1] = new TIFFField(283, TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{(long)100, (long)1},{(long)0 ,(long)0}});
    param.setExtraFields(extras);
    OutputStream outputStream = new FileOutputStream ("c:/test.tif");
    TIFFImageEncoder encoder = new TIFFImageEncoder (outputStream, param);
    encoder.encode(src);
    outputStream.close();
    outputStream = null;
    Any help would be highly appreciated
    Thanks & Regards
    George Azzopardi

    Maybe it's because you're not setting the resolution unit (tag 296)
    Example:
    TIFFField[] extras = new TIFFField[3];
    extras[0] = new TIFFField(282,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{200,(long)1},{(long)0 ,(long)0}}); //x
    extras[1] = new TIFFField(283,TIFFField.TIFF_RATIONAL, 1, (Object)new long[][] {{100,(long)1},{(long)0 ,(long)0}}); //y
    //set resolution unit to inches
    extras[2] = new TIFFField(296, TIFFField.TIFF_SHORT, 1, (Object) new char[] {2}); //2 for inches
    param.setExtraFields(extras);

Maybe you are looking for

  • Can I display rich text in a textfield?

    I've created a form in LiveCycle Designer and there is a text field that is retrieving data from a table. The data in this field is entered from a ColdFusion form and its using the Rich Text Editor in the form. Because of this, the data that is displ

  • Are my iTunes forsaken?

    Hey there. Six months or so ago, I plugged in my iPod to my PC, and just then my USB ports caught fire. After the smoke cleared, my USB ports were now defunct. A few months later, yesterday in fact, I bought a MacBookPro. Now I want all my iTunes fro

  • ImageIcons read from database don't appear

    Hi, I create a JavaBean to show images from filesystem and database (oracle9i) in a JTable. The ImageIcons loaded from filesystem appear fine whith my defined DefaultTabelModel. The ImageIcons read from database (jdbc2) with the same DefaultTabelMode

  • Report Painter Confg  - Urgent

    Hiiii all of u can u plsss send me confg documentation with screen shots regarding Report Painter... My mail ID is - [email protected] Plssss send it to me friends my client is asking reguralry..it is very urgent for B/S and P& L reports thanks in ad

  • Approvals Discount

    Hi, the sales center make diferent discount for an item, how can send discount to manager for approvals. Thanks