Problem displaying TIFF BufferedImage. It's all black.

Hello,
I am new to Java2D and I have a problem. I have a BufferedImage, bi1, created from a RenderedOp object (containing a grayscale TIFF image). I now would like to copy a part of bi1 to another BufferedImage, bi2. Creating and displaying bi1 works fine, but when I try to display bi2 it's all black. Since that is the default background color of BufferedImage, I guess this meens that my copying wasn't successful.
So my question is: How do I set the data in bi2 correctly?
Thanks in advance.
My code looks something like this:
FileSeekableStream stream = null;
try {
stream = new FileSeekableStream(args[0]);
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
ParameterBlock params = new ParameterBlock();
params.add(stream);
TIFFDecodeParam decodeParam = new TIFFDecodeParam();
decodeParam.setDecodePaletteAsShorts(true);
RenderedOp image = JAI.create("tiff", params);
int tiff_width = image.getWidth();
int tiff_height = image.getHeight();
BufferedImage bi1 = image.getAsBufferedImage();
BufferedImage bi2 = new BufferedImage(tiff_width, (int)Math.round(tiff_height*0.35), BufferedImage.TYPE_BYTE_GRAY);
     bi2.getRaster().setRect(bi1.getData(new Rectangle(0,(int)Math.round(tiff_height*0.65),tiff_width,(int)Math.round(tiff_height*0.35))));
ScrollingImagePanel panel = new ScrollingImagePanel(bi2, tiff_width, tiff_height);
Frame window = new Frame("");
window.add(panel);
window.pack();
window.show();

The BufferedImage class has method
public BufferedImage getSubimage(int x, int y, int w, int h);
Probably you might use it
bi2=bi1.getSubImage(0,0, newWidth,newHeight);
hope this helps
Stas

Similar Messages

  • Problem displaying tiff files using ADF

    Hi,
    I have some TIFF files in a table - IMAGE_TABLE
    ID NOT NULL NUMBER
    DESCRIPTION VARCHAR2(40)
    IMAGE ORDSYS.ORDIMAGE
    I am unable to display TIFF images in an ADF form. I can use processCopy to convert the TIFF images to jpeg, which them display correctly. All other JPEG or GIF display correctly, it's only the TIFF that don't. I've tried variours tiff files (different sources, converted gif and jpeg to tiff) but none display correctly (i.e. in IE you get the red 'x' - in firefox you get the broken picture symbol or nothing)?
    This appears to be an ADF issue as I 'can' dsiplay the TIFF files correctly in IE and firefox using the quicktime plugin but not from an ADF form using JDdevloper? (The code/application is Steve Muench's JSFOrdImageExample - http://otn.oracle.com/products/jdev/tips/muench/jsfordimage/JSFOrdImageExample.zip)
    Any ideas or suggestion would be appreciated.
    Thanks.
    JDeveloper 10.1.3 build 10.1.3.0.4
    DB is 10gr2

    Hi,
    yes, I can view tiff's in browsers (IE and firefox) using the quicktime plugin. I've selected quicktime as the player in the af:objectmedia property settings and Autostart = true, but using the ADF form from JDeveloper will not display tiff images (jpg's, giff's etc. are fine) even though the browser will display tiff's on it's own?
    Thanks.

  • Problem displaying tiff files

    Hi,
    I have some TIFF files in a table - IMAGE_TABLE
    ID NOT NULL NUMBER
    DESCRIPTION VARCHAR2(40)
    IMAGE ORDSYS.ORDIMAGE
    I am unable to display the TIFF images in an ADF form. I can use processCopy to convert the TIFF images to jpeg, which them display correctly. All other JPEG or GIF display correctly, it's only the TIFF that don't. I've tried variours tiff files (different sources, converted gif and jpeg to tiff) but none display correctly (i.e. in IE you get the red 'x' - in firefox you get the broken picture symbol or nothing)?
    Any ideas or suggestion would be appreciated.
    Is this an ADF issue?
    Thanks.
    JDeveloper 10.1.3 build 10.1.3.0.4
    DB is 10gr2

    Hi,
    yes, I can view tiff's in browsers (IE and firefox) using the quicktime plugin. I've selected quicktime as the player in the af:objectmedia property settings and Autostart = true, but using the ADF form from JDeveloper will not display tiff images (jpg's, giff's etc. are fine) even though the browser will display tiff's on it's own?
    Thanks.

  • When I open a pdf in Adobe Acrobat xi pro it is not displaying correctly. If a file is all black with orange writing, I will see only the orange writing. Its not until i print it or open crop pages dialog box that i see the background. i am on a Windows 7

    When I open a pdf in Adobe Acrobat xi pro it is not displaying correctly. If a file is all black with orange writing, I will see only the orange writing. Its not until i print it or open crop pages dialog box that i see the background.
    i am on a Windows 7 professional PC, 64-bit.

    If anyone is reading this still looking for what caused the issue and how to fix it here is what I discovered.
    The antivirus program our company uses, Bitdefender Antivirus Plus, was causing some of the PDF files not to open. After troubleshooting the different modules and settings the culprit was..
    Scan SSL in Privacy Control Settings. Turning it OFF solved the problem and all the PDF files that previously would not open now open just fine. This issue has been sent to Bitdefender for them to review. If you use a different antivirus program and are having this issue try locating the Scan SSL setting and see if turning it off solves the problem.

  • My iphone has a problem, it simply does not work, the screen is all black with a few colorful scribbles and images blend, I used it only took 6 days and returned to service when operated only 7 more days and it happened again the same thing, what do I do?

    My iphone has a problem, it simply does not work, the screen is all black with a few colorful scribbles and images blend, I used it only took 6 days and returned to service when operated only 7 more days and it happened again the same thing, what do I do?

    Reset the PRAM
    Reinstall the operating system from the dvd (you will not loose your data)

  • HELP PLEASE Acrobat Pro 8 for MAC PDF files printing all black pages (other file formats JPG and TIFF and XLS etc are fine)

    Pages print blackout  or black washout fuzzy when using scanned image to PDF creation or "Save As" PDF from JPG or other.  All other documents print perfectly.  Just not PDF's.  Worked fine up until today.  If I open JPG, print to PDF and try to print that PDF file, page is all black.  Any ideas on how to resolve?  Thanks!!

    Pages print blackout  or black washout fuzzy when using scanned image to PDF creation or "Save As" PDF from JPG or other.  All other documents print perfectly.  Just not PDF's.  Worked fine up until today.  If I open JPG, print to PDF and try to print that PDF file, page is all black.  Any ideas on how to resolve?  Thanks!!

  • 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.

  • Problem view TIFF multipage images with ECL Viewer 5.1.3

    Dear All,
    using the SAPGUI 710 and CV04N, I cannot view the same TIFF multipage image twice in ECL Viewer, the second time, the first time every thing is ok, but the second time the SAPGUI display the error : "File C:Docume1dupondLOCALS1TempZEP_0457895 cannot be created"
    To view again the TIFF mulitpage image, I need to kill the sapLogon.exe process and relaunch it again.
    It seams the TIFF image file is locked by the  the saplogon.exe process the first time and on the second time, SAP cannot rewrite the temporay TIFF image file. 
    Notes:
    - I use CV04N or CV03N to view the documents.
    - This problem doesn't happends with non multipage TIFF image.
    - Tested on more than 20 computers.
    - Computers are with Windows XP SP2 + SAP GUI 7.10 Compilation 2 + SP9 + SP12 +  - ECL Viewer 5.1.3 (integrated with Comp 2)
    How can I fix this problem ?
    Thank you for your help
    I think this is not the correct forum to post this king of problem, i create the same post on
    Expert Forums » Application Server » SAP GUI » [Problem view TIFF multipage images with ECL Viewer 5.1.3|;
    Edited by: Patrick Zufferey on May 5, 2009 11:41 PM

    Can you upgrade the ECL viewer to version 6.0 and check whether the same problem still exists? you can download from service.sap.com

  • Re PDF"s printing all black.

    Hi all,
    I'm having trouble printing some PDF's only. Some are fine, others print a whole page of black.
    Even though it appears normal on the monitor. If I save as a postscript and open in Preview it is also all black. I'm using Adobe Acrobat on Powerbook G4 , OSX 10.4.11.
    The same files print normally on my PC, Windows XP, (that hurts).
    Any help really appreciated.
    tnx jeremy

    Well, I guess we should start with this... can you highlight any text in the PDF & maybe copy it? Or is it just a pic of Text?
    What happens if you Save As say a JPG in Preview?
    Seems an Adobe problem..
    I'm running OSX 10.5.8, installed adobe 9. Now while surfing using Safari some pages load automatically into adobe pdf, but background is totally black
    http://macosx.com/forums/mac-os-x-system-mac-software/312840-adobe-9-black-backg round.html
    Objects with spot colors in PDF's that have been created with Adobe Acrobat 6 on Macintosh OS X (10.2.6) import into FreeHand MX 11.0.1 as missing, white or black. The PDF files created with the Acrobat 6 format have also been reported as having issues with FreeHand MX and even other applications like Illustrator.
    This has also been reported with CMYK-TIFF images that have drop shadows applied to them.
    http://kb2.adobe.com/cps/188/tn_18893.html

  • Why is facebook is all black and unresponsive?  I logged in and then lost it and can't see anything or log out., why is facebook is all black and unresponsive?  I logged in and then lost it and can't see anything or log out.

    My phone is working and all other apps are normal exept facebook.
    I logged in a few hours ago and then it went black.  It won't open up, like it is stuck.
    I tried turning the iphone off but facebook still comes in all black.... I am afraid I have a virus in my phone. Is that possible?  I am  unable to log out.
    Has anyone else had this problem and how did you fix it?
    Thanks!

    Try to disable the hardware acceleration in the Flash Player.
    See:
    * https://support.mozilla.org/kb/Cannot+view+full+screen+Flash+videos
    * http://www.youtube.com/swf_test.html (right-click the player: Settings)
    Flash "Display settings" window:
    * http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • In history displays. put checkmarks and select all.

    In history displays. put checkmarks and select all.

    Can you clarify what you mean?
    Do you have a problem with the history?
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    *Use a compressed image type like PNG or JPG to save the screenshot
    *Make sure that you do not exceed the maximum size of 1 MB

  • Problem displaying CLOB in text file

    Hello All,
    I have a problem displaying the content from the database in notepad. When I click on a link on my jsf screen, I retrieve the data and display it in notepad.
    I have my text content stored in the database with CLOB datatype. When I look in the database the data looks in the following format:
    ---------STARTS FROM NEXT LINE-------------
    The firm, known for its keen oversight of products, has been the subject of complaints from firms who have had apps blocked from the store. Some developers have complained that the company's rules seem inconsistent.
    Some have found apps blocked after seemingly minor updates, or for having content deemed inappropriate by them. In light of this, and after careful consideration, I believe it is unnecessary to sign this measure at this time.
    Sincerely,
    ABC
    ----------ENDS IN THE PREVIOUS LINE------------
    Now when I display this content onto the notepad, all the spaces and new line characters are lost, and the entire display looks awkward. This is how it looks:
    The firm, known for its keen oversight of products, has been the subject of complaints from firms who have had apps blocked from the store. Some developers have complained that the company's rules seem inconsistent.[]Some have found apps blocked after seemingly minor updates, or for having content deemed inappropriate by them. In light of this, and after careful consideration, I believe it is unnecessary to sign this measure at this time.[]Sincerely,[]ABC
    All the new line characters are lost and it just puts some junk character in place of a new line.
    When I copy the same text onto textpad, everything is alright and it displays exactly the way it is present in the database. I am also open to display the content in html, but in HTML it doesn't even display me the junk character in place of new line. It is just one single string without any line separators.
    I am using the following code to put the content into the text.
    public String writeMessage(){
       OutputStream outStream = null;
       HttpServletResponse response = getServletResponseFromFacesContext();
       Reader data = null;
       Writer writer = null;
       try{
          response.reset();
          response.setContentType("text/plain; charset=UTF-8");
          response.setHeader("Content-Disposition","attachment; filename="+id+"_Message.txt");
          outStream = response.getOutputStream();
          QueryRemote remote = serviceLocator.getQueriessEJB();
          data = remote.retrieveGovernorsVetoMessage(billId);
          writer = new BufferedWriter(new OutputStreamWriter( outStream, "UTF-8" ) );
          int charsRead;
          char[] cbuf = new char[1024];
          while ((charsRead = data.read(cbuf)) != -1) {
             System.out.println(charsRead);
          writer.write(cbuf, 0, charsRead);
          writer.flush();
       }catch(Exception ex){
          ex.printStackTrace();
       }finally{
          //Close outStream, data, writer
          facesContext.responseComplete();
       return null;
    }Any help or hints on resolving this issue would be highly appreciated.
    Thanks.

    The data is imported from a third party application to my database. It doesn't display any newline characters when I view the data.
    But when I do a regular expression search on text pad, I could see that my clob contains \n as the new line character. Is there a way to replace \n with \n\r while writing the data.
    Thanks.

  • Printing problem - HP Officejet Pro 8500 Wireless All-in-One Printer - printer head?

    I posted this elsewhere, but I think I posted it on the wrong Forum so I am posting it here now. I hope I did not do anything to upset anyone. I am new to this area, please forgive my clumsiness.
    I have a HP Officejet Pro 8500 Wireless All-in-One Printer. I've had my printer since December 2009 and no problems. I recently bought a new laptop with Windows 7 and had to go online to find the drivers that work for my printer. Windows 7 was not compatible with this printer.
    Also recently, I am having a problem with what I think may be the black printer head, but when I run diagnostic on it everything comes back saying it is fine. However the problem still exist. When printing the black color will become faded in some areas and in some lines will not only almost totally fade out, but will almost look italic.
    Can you tell me if this is the printer head and does it need replacing or is there another problem?
    SondraS

    Are you using genuine HP cartridges and not refilled or third-party cartridges?
    Print the Print Quality Diagnostic page from the setup menu/print report/ on the printer's front panel
    Are there any quality issues with this page?
    Although I am a HP employee, I am speaking on behalf of myself and not the company.

  • Difficulty using a projector. I have a MBP 17" and am running 10.6.8. Often I need to make a Powerpoint or other presentation  at a client and I want to connect my computer to their projector. Either it won't display on the projector at all. HELP!

    Difficulty using a projector. I have a MBP 17" and am running 10.6.8. Often I need to make a Powerpoint or other presentation  at a client and I want to connect my computer to their projector. Either it won't display on the projector at all. Once it displayed but the presentation mode was on the big screen and the presentation I wanted to show was on my MBP screen. I have the adapter( white ones) to attached to the projector cables.  I am so frsutrated...it looks so silly not to have a computer work during a presentation..
    Another problem one the rare occasion that it shows on the screen is that the presentation does show just my desk top.  Any ideas?
    Thanks !

    You often have to turn off Mirroring to be able to set the second "screen"s resolution to something reasonable. When you do, the two screens become an "Exceeded Desktop" joined along one edge, and the Arrange pane in displays prefs can allow you to specify what edge. Initially, it will show a vacant extension of the built-in screen's desktop.
    The mouse moves freely across that shared edge, and can allow you to drag the presentation window across to the the projector screen and re-size it to fit.

  • Running Safari 6.0.3  When trying to print files using Adobe Reader 11.0.02, print preview screen is all black.  If files are attached to an email, receiver can't open it.  It does work OK in Firefox 19.0.2  Any ideas?

    Running Safari 6.0.3  When trying to print files using Adobe Reader 11.0.02, print preview screen is all black.  If files are attached to an email, receiver can't open it.  It does work OK in Firefox 19.0.2  Any ideas?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

Maybe you are looking for

  • How to hide the rows in report which there is no data

    Hi, I am using web I rich client Xi R3.1 version. In the report i am displaying data region wise and applied section on the column named 'business unit'. Now i see there is no data for some business units and dont want to show in the report. There ar

  • How you change the download frequency for a single Podcast?

    I have iTunes 11.1.5 for Mac, and I can't find how to change the down load frequence , aka "check for new episodes" setting for individual podcasts. I've tried using the settings menu in the "My Podcasts" and the "List" podcast view. When I do this,

  • Sequence 3 tasks - create a finite pulse train-create a delay by creating a pulse train-measure pulses

    Hello i use a board 6023E and pc pentium4 3Ghz My problem is how create a delay with few microseconds between two tasks? I need creat three tasks. Fisrt create a finte pulse train for this i use a counter. Second create a delay for this i use again a

  • Opening jpegs in Camera Raw 4.1?

    I just received some jpegs from Getty and I decided to see what they looked like when I opened them using ACR as opposed to just opening them in PSCS3. What I found was that with the default settings the files from ACR had less saturation? The jpegs

  • Is it that underpowered?

    I just bought this computer. My old pavillion was giving me fits and the budget was tight, so I chose a bottom of the line machine. I do Microsoft Office, Quickbooks, Family Tree Maker, etc. I don't do any gaming or anything that would require a part