Creating blank tiff image

Hi,
I want to create a new blank tiff image and attach the existing tiff images to this blank image side by side or columnwise.
How can i do this using java/JAI ?

Create the image on the hard disk, compress it or use a tool such as this one to split it into two, and move the compressed or segmented file to the external drive.
(37541)

Similar Messages

  • Unable to create blank CD image

    I am unable to create a blank MS-DOS FAT CD image using Disk Utility.
    New Image
    size: 663 (CD-ROM 80min)
    Format: MS-DOS (FAT)
    Encryption: none
    Partitions CD/DVD
    Image Format: read/write disk image
    Hit [Create] button then progress bar appears and moves to completion. Then an error message box appears that says "Unable to create "test2.dmg." (Invalid argument)
    Need to get this done so I can create gift CD's of my photos so if you know a work around for buidling a PC compatible CD I can take that too.
    Thanks so much for your help.
    Frank

    Allan,
    Thanks for the response.
    I am making photo CDs for the parents of my son's soccer team. On each CD I put the JPEG originals plus a Flash slide show.
    In the past this is what I have done:
    1. In Disk Utility -> New Image with above parameters
    2. Mount the new image
    3. Put JPEGS and flash show on the image
    4. In Disk Utility, select the image and select Burn
    If I do this with MS-DOS (FAT) format, then anyone can read it (PC or MAC). If I use the Mac OS Extended (Journaled) then it can only be read on a MAC.
    Can you think of another way to create a data CD?
    Thanks!

  • 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

  • MBA old gen. and Snow Leopard - TIFF images seen as blank in some web pages

    After I upgraded to Snow Leopard, I see blank the TIFF images displayed in some web sites, like for example any patent image in the www.uspto.gov web site.
    This happens on both Safari and Firefox. They both use the QuickTime plugin (I have version 7.6.3).
    However, if I drag and drop the TIFF image and save it in the local hard drive, local applications like Preview display the page correctly.
    It seems to be an issue with QuickTime and possibly the MacBook model (I have a first generation MacBook Air, with the GMA X3100 Intel graphic card).
    Has anybody experienced this bug?

    Any patent image in the www.upsto.gov web site. For example, this link goes to the first page of the U.S. Patent 161,739 Improvement in Transmitters and Receivers for Electric Telegraphs by A.G. Bell:
    http://patimg1.uspto.gov/.piw?Docid=00161739&homeurl=http%3A%2F%2Fpatft.uspto.go v%2Fnetacgi%2Fnph-Parser%3FSect1%3DPTO1%2526Sect2%3DHITOFF%2526d%3DPALL%2526p%3D 1%2526u%3D%25252Fnetahtml%25252FPTO%25252Fsrchnum.htm%2526r%3D1%2526f%3DG%2526l% 3D50%2526s1%3D0161739.PN.%2526OS%3DPN%2F0161739%2526RS%3DPN%2F0161739&PageNum=&R type=&SectionNum=&idkey=NONE&Input=Viewfirstpage
    All I see a blank page.

  • TIFF images are shown as blank when embedded in some web pages

    After I upgraded to Snow Leopard, I see blank the TIFF images displayed in some web sites, like for example any patent image in the www.uspto.gov web site.
    This happens on both Safari and Firefox. They both use the QuickTime plugin (I have version 7.6.3).
    However, if I drag and drop the TIFF image and save it in the local hard drive, local applications like Preview display the page correctly.
    It seems to be an issue with QuickTime and possibly the MacBook model (I have a first generation MacBook Air, with the GMA X3100 Intel graphic card).
    Has anybody experienced this bug?

    Any patent image in the www.upsto.gov web site. For example, this link goes to the first page of the U.S. Patent 161,739 Improvement in Transmitters and Receivers for Electric Telegraphs by A.G. Bell:
    http://patimg1.uspto.gov/.piw?Docid=00161739&homeurl=http%3A%2F%2Fpatft.uspto.go v%2Fnetacgi%2Fnph-Parser%3FSect1%3DPTO1%2526Sect2%3DHITOFF%2526d%3DPALL%2526p%3D 1%2526u%3D%25252Fnetahtml%25252FPTO%25252Fsrchnum.htm%2526r%3D1%2526f%3DG%2526l% 3D50%2526s1%3D0161739.PN.%2526OS%3DPN%2F0161739%2526RS%3DPN%2F0161739&PageNum=&R type=&SectionNum=&idkey=NONE&Input=Viewfirstpage
    All I see a blank page.

  • Acrobat 7.0.5 for Windows -- Problem creating a PDF from a TIFF image

    I have a user who is attempting to create a PDF from a TIFF image using the Adobe PDF print driver (Acrobat 7.0.5). His computer is a 3.4 GHz Intel Pentium 4 with 1 GB of RAM. His operating system is WinXP Pro SP2. The TIFF file he is trying to convert is about 2000 pages long. Is this even possible given the hardware and resources I've described?

    Sorry, I should have been more explicit...The TIFF image is a multi-page image and is stored in a database here at our office. The user has a proprietary (internally-coded) viewer that's used to open the image from the database, and there's no way to save the image locally. The user wants to be able to search within the image, so he converts it to a PDF. Ordinarily, this works very nicely, but this is his first time trying to do it with an image of more than 1000 pages length.

  • Can't delete a logical volume group created from a blank disk image

    Hi all,
    I'm a recent convert from Windows, so do bear with me while I grapple with all the new terminology.
    Basically, here's the problem: I've been trying to create an encrypted drive and have been at it for a few hours now. I ended up with two 'logical volume groups' created from blank disk images, neither of which are password-protected, and one of which I quite stupidly named "hidden folder" and can't rename now. Anyways, I decided to throw it all away and start right from scratch, but now disk utility won't let me delete these two logical volume groups despite me dismounting both devices, trying to trash the containing folder, etc. Some searching about online has gotten me into the belief that there should be an 'erase' tab in the disk utility window which is not showing up when I click on those drives (however, the erase tab does appear when I click on the indented partitions on each drive). Here's a screenshot to give you guys an idea:
    -Here's the disk utility window. The two drives I'm trying to get rid of are "Hidden Folder" and "HD2"
    -Here's what I suppose would be called the 'containing folder' in which both drives reside
    -And finally my setup, just in case it's relevant
    Oh and btw this would be my first post here! How exciting
    Thanks in advance,
    Arthur

    nidra wrote:
    When I right click on it these are the choices: Open; Move to Trash; Get Info; Compress...; Burn ... to disc; Duplicate; Make Alias; Copy ...; Clean Up Selection; Show view options; Label; Folder Actions Setup.
    That is as it should be. If you select "Move to Trash" does it move the folders to the trash? If so, do the following from my previous post:
    tjk wrote:
    1. Open Terminal (in Applications, Utilities).
    2. Copy and paste the following command into the Terminal window (or type it exactly as follows):
    sudo rm -rf ~/.Trash/*
    3. Press Return.
    4. Type in your password when asked (note: you will not see anything being entered as you type your password).
    5. Hit Return.
    6. Wait until the process finishes/the Terminal prompt returns.
    7. Quit Terminal.
    I wonder if I need to do some changes to the rights about doing this action "move to trash"?
    Run Repair Permissions in Disk Utility.
    this is making me very uncomfortable, I know myself to solve any problems I tackle/___sbsstatic___/migration-images/migration-img-not-avail.png Something so simple as this is making me crazy
    I don't know if it would make me any crazier than I am, but I sure wouldn't want a stray folder just hanging around on my desktop either.

  • Creating PDF/A 1-a file from Tiff Image

    I am trying to create a PDF/A 1-a file from a Tiff Image file. But it gives an error.
    When i try to check the compliance using Preflight, I find that StructTreeRoot is giving the problem.
    Can anyone suggest how to converty Tiff image to PDF/A 1-a compliant pdf file.
    I am using Adobe Acrobat Pro 9 Version 9.0
    Regards,
    Abhilash

    Thanks for the prompt reply.
    But i have created a pdf/a 1-a file from a tiff file using tool img2pdf.exe provided by www.pdf-tools.com
    It created a pdf/a 1-a file which the preflight shows as a pdf/a 1-a compliant PDF.
    Regards,
    Abhilash

  • Computer Crashes when creating new blank disk image

    I'm trying to dreacte a new blank disk image from Disk Utility, but when I select "New Blank Image", I name the disk and hit "Create"my compter crashes and requires restart. Any ideas as to why and how to fix?

    Yes, iMovie '08 is more "resource intensive" than iMovie HD. (It takes a lot more RAM to provide all that nice scrubbing ability.)
    I'm not sure how large the project you're burning is, but I will say that 1GB of RAM is really low for working with video. Anytime a computer starts running out of free memory, bad things start happening. Applications crash, the system appears to hang, etc. When you quit all the other applications you were running, you freed up RAM for iMovie to use.
    I would suggest you bump up the RAM in your machine to at least 2GB. It's not very expensive at all. Less than $80. You can get to 4Gb of RAM for $110! I'd be willing to bet that once you've got more available memory your problem will vanish.

  • Using binarize... Getting Tiff Image in Black Background..

    Hi,
    Basically my subject summarizes my problem, but I am trying to write some text to a blank JPEG file and then create a Tiff file from that JPEG...
    But When i use the binarize i am getting the image as black background and the resolution is not that great...
    I am using binarize, because i need to use TIFFEncodeParam.COMPRESSION_GROUP4 but i was getting bi-level error, that is why i am using binarize to create a GROUP4 with black and white color to minimize the file size...
    I am posting the source code, i would appreciate someone can take a look at this code and figure out why i am getting black background...in the tiff file...
    Any help will be greatly appreciated...
    Thanks in advance...
    ========================================
    import javax.swing.UIManager;
    import java.awt.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class Application1 {
    private boolean packFrame = false;
    //Construct the application
    public Application1() {
    Frame1 frame = new Frame1();
    frame.setVisible(true);
    //Main method
    public static void main(String[] args) {
    new Application1();
    ================================================
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import com.sun.image.codec.jpeg.*;
    import com.sun.media.jai.codec.*;
    import javax.media.jai.*;
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.awt.image.DataBuffer;
    import java.awt.geom.GeneralPath;
    import java.io.*;
    import java.awt.image.renderable.ParameterBlock;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class Frame1 extends JFrame implements java.io.Serializable {
    private JPanel contentPane;
    private JButton jButton1 = new JButton();
    public static final String DEFAULT_FILE = "blank.jpg";
    private static RenderedImage img;
    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
    contentPane = (JPanel) this.getContentPane();
    jButton1.setBounds(new Rectangle(125, 87, 79, 27));
    jButton1.setText("jButton1");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton1_actionPerformed(e);
    contentPane.setLayout(null);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    contentPane.add(jButton1, null);
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void jButton1_actionPerformed(ActionEvent e) {
    String fileName = DEFAULT_FILE;
    // Read the image from the designated path.
    System.out.println("load image from '" + fileName+"'");
    PlanarImage src = JAI.create("fileload", fileName);
    // Generate a histogram...
    Histogram histogram = (Histogram)JAI.create("histogram", src).getProperty("histogram");
    // Get a threshold equal to the median..
    double[] threshold = histogram.getPTileThreshold(0.5);
    PlanarImage dst = JAI.create("binarize", src, new Double(threshold[0]));
    BufferedImage bi = dst.getAsBufferedImage();
    Graphics2D big = bi.createGraphics();
    Graphics2D g2 = bi.createGraphics();
    big.setFont(new Font("Dialog", Font.PLAIN, 20));
    big.setColor(Color.black);
    big.drawString("Data/Time Created:" + new java.util.Date(), 80, 210);
    big.drawString("POLICY NUMBER: 1711215 NAME OF CALLER: BENEFICIARY", 80, 230);
    big.drawString("Requested: Loan Request XXXXXXXXXXXXXXXXXXXXXXXXXXXXX Current Loan Value: $0.00", 80, 270);
    g2.drawImage(bi, 0, 0, null);
    try {
    File file = new File("test.tiff");
    FileOutputStream out = new FileOutputStream(file);
    TIFFEncodeParam params = new TIFFEncodeParam();
    params.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF",out, params);
    if(encoder == null) {
    System.out.println("imageEncoder is null");
    System.exit(0);
    encoder.encode(bi);
    System.out.println("DONE!!!");
    catch (Exception ex) {

    try this:
    BufferedImage bi = new BufferedImage(1728,500,BufferedImage.TYPE_BYTE_BINARY);
    Graphics2D big = bi.createGraphics();
    Graphics2D g2 = bi.createGraphics();
    big.setFont(new Font("Dialog", Font.PLAIN, 20));
    big.setColor(Color.WHITE);
    big.fillRect(0,0,1728,500);
    big.setColor(Color.BLACK);
    big.drawString("Data/Time Created:" + new java.util.Date(), 80, 210);
    big.drawString("POLICY NUMBER: 1711215 NAME OF CALLER: BENEFICIARY", 80, 230);
    big.drawString("Requested: Loan Request XXXXXXXXXXXXXXXXXXXXXXXXXXXXX Current Loan Value: $0.00", 80, 270);
    g2.drawImage(bi, 0, 0, null);

  • How can I merge two TIFF images in one...?

    I need some help please, I am looking for a way to "resize" black & white single TIFF images.
    The process I need to do is like cutting a small image and paste it over a new blank letter-size image (at 300 dpi), like a template.
    Or better yet, is there a way to do something like this...?
    Open image...
    image.*width* = 2550;
    image.*height* = 3300;
    image.save();Some APIs and topics in the internet do or talk about resizing, but the final images get stretched or shrinked and I need them not to do so at all.
    Also, I do not need to display the images, only to get the TIFF images processed and saved back to a file.
    How can I do this with Java and JAI? Unfortunately I am almost new to this and I don't know how difficult it might be to deal with images.

    If 2550 x 3300 isn't the original aspect ratio of the image, then the image is going to looked streched or shrinked in at least one dimension. There is no way around that. It would be like resizing a 2 pixel by 2 pixel image into a 3 pixel by 6 pixel image. The image would look like it's height shrunk or it's width stretched. Had I resized it to 3 pixels by 3 pixels or 6 pixels by 6 pixels, though, then it wouldn't look shrunken or streched.
    Open image...
    image.*width* = 2550;
    image.*height* = 3300;
    image.save();*1)* To open a TIFF image you can use the javax.swing.ImageIO class. It has these static methods
    read(File input)
    read(ImageInputStream stream)
    read(InputStream input)
    read(URL input) You can use which ever method you want. But first you need to install [JAI-ImageIO|https://jai-imageio.dev.java.net/binary-builds.html]. The default ImageReaders that plug themselves into the ImageIO package are BMP, PNG, GIF, and JPEG. JAI-ImageIO will add TIFF, and a few other formats.
    The downside is that if clients want to you use your program on their machine then they to will need to install JAI-ImageIO to read the tiffs. To get around this, you can go to your Java/jdk1.x.x_xx/jre/lib/ext/ folder and copy the jai_imageio.jar file (after you've installed JAI-ImageIO). You can also obtain this jar from any one of the zip files of the [daily builds|https://jai-imageio.dev.java.net/binary-builds.html#Daily_builds]. If you add this jar to your program's classpath and package it together with your program, then clients won't need to install JAI-ImageIO and you'll still be able to read TIFF's. The downside of simply adding the jar to the classpath is that you won't be able to take advantage of a natively accelerated JPEG reader that comes with installing JAI-ImageIO (instead, ImageIO will use the default one).
    *2)* Once you've installed [JAI-ImageIO|https://jai-imageio.dev.java.net/binary-builds.html] and used ImageIO.read(...), you'll have a BufferedImage. To resize it you can do the following
    BufferedImage newImage = new BufferedImage(2550,3300,BufferedImage.TYPE_BYTE_BINARY);
    Graphics2D g = newImage.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g.drawImage(oldImage,0,0,2550,3300,null);
    g.dispose();Here, I simply drew the old image (the one returned by ImageIO.read(...)) onto a new BufferedImage object of the appropriate size. Because you said they were black and white TIFF's, I used BufferedImage.TYPE_BYTE_BINARY, which is a black and white image. If you decide to use one the BufferedImage types that support color, then a 2550x3330 image would require at least 25 megabytes to hold into memory. On the other hand, a binary image of that size will only take up about one meg.
    I specified on the graphics object that I wanted Bilinear Interpolation when scaling. The default is Nearest Neighbor interpolation, which while fast, dosen't look very good. Bilinear offers pretty good results scaling both up or down at fast speeds. Bicubic interpolation is the next step up. If you find the resized image to be subpar, then come back and post. There are a couple of other ways to resize an image.
    Note, however, if 2550 x 3300 is not the same aspect ratio as the the TIFF image you loaded, then the resized image will look shrunk or stretched along one dimension. There is absolutely no way around this no matter what resizing technique you use. You'll need an image whose original dimensions are in a 2550/3300 = .772 ratio if you want the resized image to not look like it's streched (you can crop the opened image if you want).
    *3)* Now we save the "newImage" with the same class we read images with: ImageIO . It has these static methods
    write(RenderedImage im, String formatName, File output)
    write(RenderedImage im, String formatName, ImageOutputStream output)
    write(RenderedImage im, String formatName, OutputStream output)You'll suply the resized BufferedImage as the first parameter, "tiff" as the second parameter and an appropriate output for the third parameter. It's pretty much a one line statement to read or write an image. All in all, the whole thing is about 7 lines of code. Not bad of all.
    Now as for the 300 dpi thing, there is a way to set the dpi in the Image's metadata. I'm pretty good at reading an image's metadata, but I've never really tried writing out my own metadata. I know you can set the dpi, and I have a somewhat vague idea how it might be done, but it's not something I've tried before. I think I'll look more into it.

  • How do I create a disk image for windows 7, using a windows computer for USB bootcamp for mac?

    Hi There, I have just bought a new 2013 iMac.
    Spec: 3.4 GHz intel core i5, 16GB 1600 MHz DDR3 Memory , NVIDIA GeForce GTX 775M 2048 MB Graphics with OS X 10.9.4.
    How can I create a 'disk image' from a windows 7 professional 64bit installation DVD using a windows laptop with windows 7 Operating system on? I want to transfer this 'disk image' (ISO?) to a USB ready for installing windows onto my 2013 iMac using bootcamp?  I want to use bootcamp from a USB as I have no disk drive for the installation DVD on my iMac. I hope all this is clear.
    Thank you. Joe

    Yes, that's correct, at least not directly. You can create a blank disk image, copy the file to the mounted disk image, then burn the image to a CD/DVD.
    Open Disk Utility and select Blank Disk Image from the New menu. Provide a name, Save location, and select the image size from the drop down menu. Leave Encryptions at None and Format as read/write. Click on the Create button.
    After the image file appears the "removable" disk should be automatically mounted. If not double-click on it to mount it. A "removable" disk icon will appear. Drag the file you want to place on the disk image to the "removable" disk icon. The eject the "removable" disk icon. Now select the disk image file in the DU left side list and click on the Burn icon in the DU toolbar. Be sure to have a blank disc ready.
    The above is actually the "long" way to do this. A much easier way is to simply insert a blank CD or DVD into the optical drive. The Finder will pop up a dialog asking what to do. Select the option to mount on the Desktop. You will now see a disc icon on the Desktop. Drag the file you want to burn to the CD/DVD, right-click or CTRL-click on the disc icon and select Burn from the contextual menu.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • Java returning incorrect values for width and height of a Tiff image

    I have some TIFF images (sorry, I cannot post them b/c of there confidential nature) that are returning the incorrect values for the width and height. I am using Image.getWidth(null) and have tried the relevant methods from BufferedImage. When I open the same files in external viewers (Irfanview, MS Office Document Imaging) they look fine and report the "correct" dimensions. When I re-save the files, my code works fine. Obviously, there is something wrong with the files, but why would the Java code fail and not the external viewers? Is there some way I can detect file problems?
    Here is the code, the relevant section is in the print() routine.
    * ImagePrinter.java
    * Created on Feb 27, 2008
    * Created by tso1207
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.print.PageFormat;
    import java.awt.print.PrinterException;
    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.FileImageInputStream;
    import javax.imageio.stream.ImageInputStream;
    import com.shelter.io.FileTypeIdentifier;
    public class ImagePrinter extends FilePrintable
       private final ImageReader _reader;
       private final int _pageCount;
       private final boolean _isTiff;
       //for speed we will hold current page info in memory
       private Image _image = null;
       private int _imgWidth = 0;
       private int _imgHeight = 0;
       private int _currentPage = -1;
       public ImagePrinter(File imageFile) throws IOException
          super(imageFile);
          ImageInputStream fis = new FileImageInputStream(getFile());
          Iterator readerIter = ImageIO.getImageReaders(fis);
          ImageReader reader = null;
          while (readerIter.hasNext())
             reader = (ImageReader) readerIter.next();
          reader.setInput(fis);
          _reader = reader;
          int pageCount = 1;
          String mimeType = FileTypeIdentifier.getMimeType(imageFile, true);
          if (mimeType.equalsIgnoreCase("image/tiff"))
             _isTiff = true;
             pageCount = reader.getNumImages(true);
          else
             _isTiff = false;
          _pageCount = pageCount;
       public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          throws java.awt.print.PrinterException
          int drawX = 0, drawY = 0;
          double scaleRatio = 1;
          if (getCurrentPage() != (pageIndex - getPageOffset()))
             try
                setCurrentPage(pageIndex - getPageOffset());
                setImage(_reader.read(getCurrentPage()));
                setImgWidth(getImage().getWidth(null));
                setImgHeight(getImage().getHeight(null));
             catch (IndexOutOfBoundsException e)
                return NO_SUCH_PAGE;
             catch (IOException e)
                throw new PrinterException(e.getLocalizedMessage());
             if (!_isTiff && getImgWidth() > getImgHeight())
                pf.setOrientation(PageFormat.LANDSCAPE);
             else
                pf.setOrientation(PageFormat.PORTRAIT);
          Graphics2D g2 = (Graphics2D) g;
          g2.translate(pf.getImageableX(), pf.getImageableY());
          g2.setClip(0, 0, (int) pf.getImageableWidth(), (int) pf.getImageableHeight());
          scaleRatio =
             (double) ((getImgWidth() > getImgHeight())
                ? (pf.getImageableWidth() / getImgWidth())
                : (pf.getImageableHeight() / getImgHeight()));
          //check the scale ratio to make sure that we will not write something off the page
          if ((getImgWidth() * scaleRatio) > pf.getImageableWidth())
             scaleRatio = (pf.getImageableWidth() / getImgWidth());
          else if ((getImgHeight() * scaleRatio) > pf.getImageableHeight())
             scaleRatio = (pf.getImageableHeight() / getImgHeight());
          int drawWidth = getImgWidth();
          int drawHeight = getImgHeight();
          //center image
          if (scaleRatio < 1)
             drawX = (int) ((pf.getImageableWidth() - (getImgWidth() * scaleRatio)) / 2);
             drawY = (int) ((pf.getImageableHeight() - (getImgHeight() * scaleRatio)) / 2);
             drawWidth = (int) (getImgWidth() * scaleRatio);
             drawHeight = (int) (getImgHeight() * scaleRatio);
          else
             drawX = (int) (pf.getImageableWidth() - getImgWidth()) / 2;
             drawY = (int) (pf.getImageableHeight() - getImgHeight()) / 2;
          g2.drawImage(getImage(), drawX, drawY, drawWidth, drawHeight, null);
          g2.dispose();
          return PAGE_EXISTS;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since version XXX
        * @return
       public int getPageCount()
          return _pageCount;
       public void destroy()
          setImage(null);
          try
             _reader.reset();
             _reader.dispose();
          catch (Exception e)
          System.gc();
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public Image getImage()
          return _image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgHeight()
          return _imgHeight;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgWidth()
          return _imgWidth;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param image
       public void setImage(Image image)
          _image = image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgHeight(int i)
          _imgHeight = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgWidth(int i)
          _imgWidth = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getCurrentPage()
          return _currentPage;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setCurrentPage(int i)
          _currentPage = i;
    }Edited by: jloyd01 on Jul 3, 2008 8:26 AM

    Figured it out. The files have a different vertical and horizontal resolutions. In this case the horizontal resolution is 200 DPI and the vertical is 100 DPI. The imgage width and height values are based on those resolution values. I wrote a section of code to take care of the problem (at least for TIFF 6.0)
       private void setPageSize(int pageNum) throws IOException
          IIOMetadata imageMetadata = _reader.getImageMetadata(pageNum);
          //Get the IFD (Image File Directory) which is the root of all the tags
          //for this image. From here we can get all the tags in the image.
          TIFFDirectory ifd = TIFFDirectory.createFromMetadata(imageMetadata);
          double xPixles = ifd.getTIFFField(256).getAsDouble(0);
          double yPixles = ifd.getTIFFField(257).getAsDouble(0);
          double xRes = ifd.getTIFFField(282).getAsDouble(0);
          double yres = ifd.getTIFFField(283).getAsDouble(0);
          int resUnits = ifd.getTIFFField(296).getAsInt(0);
          double imageWidth = xPixles / xRes;
          double imageHeight = yPixles / yres;
          //if units are in CM convert ot inches
          if (resUnits == 3)
             imageWidth = imageWidth * 0.3937;
             imageHeight = imageHeight * 0.3937;
          //convert to pixles in 72 DPI
          imageWidth = imageWidth * 72;
          imageHeight = imageHeight * 72;
          setImgWidth((int) Math.round(imageWidth));
          setImgHeight((int) Math.round(imageHeight));
          setImgAspectRatio(imageWidth / imageHeight);
       }

  • 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});

  • How to edit 16bit TIFF image sequence file in FCP?

    Dear all,
    I have a number of 16 bit TIFF image sequence files (2048 x 1024 resolution) - some of them are RED footage, and others came directly from our f/x guy. We are going into a color correction session in a post house and we've been asked to provide a sequential 16 bit TIFF image sequence of the edited time line.
    I need to do a cross dissolve b/w most of the clips I have. I have created image sequence QT movie (reference files) from the TIFF images. Though they play fine in QT player, when I try importing into FCP, I am met with a "general error". I tried both dragging it into QT, as well as File --> Import.
    I am wondering what can I do to get these clips into FCP in order to apply the cross dissolve transitions I need. Is this a problem relating to the 16bit nature of the TIFF files?
    I tried exporting the TIFF image sequence standalone QT movie, and those imported fine. However, I have a feeling that the standalone movie conversion also decrease my bit depth from 16 to 8. (When I do my final TIFF output from FCP after dissolves / transitions had been applied, each TIFF file is now 8 MB instead of 12 MB, hence my suspicion that the bit depth is adjusted).
    Are there any settings I am missing, or does FCP simply don't support 16 bit image sequence reference file. As a test, I had also converted all my TIFF to jpg, and created jpeg image sequence reference file. These reference QT file can be successfully imported to FCP and I can edit them as if they are a clip.
    If FCP is not able to handle these files, what are my other options? After Effects?
    Any help is appreciated.
    Thank you.
    Michael
    <Edited by Moderator>

    As far as I know, both FCP and Color only support up to 10 bit color, which is 1024 levels for each color channel, more than enough for avoiding color banding.
    If you need 16 bit for sure, I believe AE will support 16 bit output. Another 16 bit application would be the extended version of Photoshop, which has some limited time line capability.

Maybe you are looking for