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

Similar Messages

  • Just upgraded to Mavericks. Now I cannot access scans from my hp scanner. After it complete the scans and I try to save as tiff, jpeg or pdf I get a either a grey blur or a message that says cannot save because the file cannot be written to.

    Just upgraded to Mavericks. Now I cannot access scans from my hp scanner. After it complete the scans and I try to save as tiff, jpeg or pdf I get a either a grey blur or a message that says cannot save because the file cannot be written to. I did not have any problems before the upgrade. I would greatly appreciate any light shed on this.

    Go to the HP site and look for drivers for your scanner. It apparently needs an updated driver to work with Mavericks.

  • I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

    I have problem in quicklook for mp4 files in my mountain lion os 10.8.2 so please help me what i need to do? but i can view mov,3gp,jpeg files problem is only with mp4 files.... any one help me...

  • Is it possible to save metadata to both files in an imported pair?  (Tiff & Jpeg).

    I imported many files that were tiff & jpeg pairs (with the import preference box checked 'Do Not treat as seprate files when file names are the same') into LR3.  Since then, i have been unable to write new metadata, such as captions, keywords, etc., to both the JPG and Tif files.  LR3, and now also LR5 both only seem to want to write to the tiff files.  How do i get the metadata easily saved onto the jeg files as well?  (preferably without re-importing as separate files).  Thank you. 

    To separate them:
    0. Make sure the 'Treat JPEGs separately' box is ticked in Lr preferences, and
    1.   Invoke the 'Separate Jpegs from Raws' feature of RawPlusJpeg, *iff* it recognizes your tiffs as raw, or
    2.1   Rename the jpegs temporarily (to an invalid extension), then resync the folder(s) (that will force Lr to forget about the sidecars).
    2.2   Rename the jpegs back, and resync again, reimporting the jpegs.
    That way, you won't need to re-import your tiffs, thus losing photo standing (e.g. collections, publish services, ... ) and edit-history...
    Rob

  • B&w colour problem

    I have uploaded this website: www.ambientdesign.com.au
    The problem is that in Internet Explorer, the colours are
    b&w. Everything else looks OK.
    Another issue (which isn't as much of a concern as the colour
    problem) is that in Mozilla a few elements move position eg: the
    text in the footer appears below the footer. Thanks for
    help.

    Are you working on this page right now?
    I see the page as I suppose it should be in Firefox, but in
    IE6 and 7, there
    is no styling whatsoever... the images are in colour, but
    it's not reading
    the stylesheet at all.
    I have no idea why, apart from the fact that it may have
    something to do
    with sitting as a sub domain of your hosting account at
    ozemail or
    something....
    May I ask why you are using frames for the site - there
    doesn't appear to be
    a real reason to use frames for that layout?
    I put the main page through the validator and there's a few
    errors that may
    need clearing up :
    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fmembers.ozemail.com.au%2F~ambient design%2F
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Customisation Service Available ~
    http://www.csstemplates.com.au
    ~ Forum Posting Guidelines ~
    http://www.adobe.com/support/forums/guidelines.html
    CSS Tutorials for Dreamweaver:
    http://www.adobe.com/devnet/dreamweaver/css.html
    "ambient2000" <[email protected]> wrote in
    message
    news:etb886$eef$[email protected]..
    >I have uploaded this website: www.ambientdesign.com.au
    >
    > The problem is that in Internet Explorer, the colours
    are b&w. Everything
    > else
    > looks OK.
    >
    > Another issue (which isn't as much of a concern as the
    colour problem) is
    > that
    > in Mozilla a few elements move position eg: the text in
    the footer appears
    > below the footer. Thanks for help.
    >

  • Camera Raw Preferences- Tiff / JPEG Handling -CS 3

    In the Camera Raw Preferences > JPEG + Tiff Handling Section I have " Always open TIFF/JPEG Files with Settings Using Camera Raw" UNCHECKED. Yet, when I double-click on an image in Bridge to open it, it opens the Raw window. I want the image to open directly in Photoshop. What do I need to do?

    There are other preferences to be UNchecked. Carefully examine Camera Raw prefs, Bridge prefs and Photoshop prefs.
    Then relaunch Bridge and Photoshop.

  • Convert to jpeg ouput problem

    When I convert eps to jpeg the output document has a checkerboard in all blank areas. I am new, it's probabaly easy, but help anyways. Thanks!

    Thanks! It was a transparency issue. Just need to select properly when "saving as".
    Date: Mon, 3 Aug 2009 13:52:01 -0600
    From: [email protected]
    To: [email protected]
    Subject: Convert to jpeg ouput problem
    It helps to be more descriptive when you post and tell us exactly what you are doing.
    That being said, I guess that you are going to file>save for web & devices. The checkerboard that you are seeing simply means that those areas are transparent.
    >

  • Anyone getting print colour problems after Mac 10.6.8 Update?

    Since June 29, when we downloaded the latest Apple OS X update, prints on all four papers I use - and have custom profiles for - have developed a green cast out of our Epson R1900. Can't help thinking that this caused by the Epson Printer Software Update (# 2.7) that was part of that Apple update. There are reams of complaints over on the Photoshop Mac forum about this update causing printers to stop completely; but none citing colour problems.
    Seems complicated - according to Apple - by the fact that the Epsom driver that Update 2.7 replaced, will not work with OS X 10.6.8. To back track one has to back track the complete OS to 6.7. Something to do with Snow Leopard being made ready for Lion.
    Oh, and yes - I have recalibrated my screen since the update; and yes, have exhaustively run all the maintenance tasks on the R1900.

    Seems we have sorted the problem, and I thought it might warrant us sharing that - particularly as it was less than obvious. We use four paper types and have pre-sets for each in the Print Module. Actually eight presets as the four are duplicated for two paper sizes. Each pre-set includes a custom-made ICC profile for the paper/printer (an Epson R1900).
    Following the Apple Software Update to OS X 10.6.8, there appeared a noticeable blue/green cast over all newly made prints. Nothing in the Lr3 printing process appeared to change; and so the conclusion was that something had changed in the new Epson printer driver that accompanied the update. Some time and effort was expended with Apple investigating a backtrack to 10.6.7, which proved fruitless for too complicated a reason to go into here.
    Left with seeking an alternative answer, we deleted the printer and reinstalled using the original disk; opting to take the offered driver update. This resulted in driver 6.20 being loaded - the same as had been causing all the grief. However, when we came to check the Print Settings dropdown - after specifying the appropriate preset - to make sure it specified 'no colour correction', it was obvious that the ICC profile had not been recognised, although the Page Settings for the preset had. Each box in the dropdown merely contained the default - plain paper, Colorsync, etc. Manually entering all the criteria in Print Settings - as should have been picked up from the preset - produced a perfect print. Perfect that is compared to one printed prior to download 10.6.8.
    The odd thing about this - and the one that left us clueless - was that before deleting and re-installing the printer - the Print Settings dropdown reflected all of the criteria of the preset. Everything looked normal, except that is for the hair being pulled out by those wasting time, paper and ink after a solution.

  • Printing Colour Problems ...

    I know this is a common cry for help, but I am having a dreadful time trying to understand colour profiles, despite spending a lot of time reading up on the subject. Here's my basic dilemma:
    I have calibrated my display (Apple 23" Cinema). I am using an old Epson 830U for basic home proofs. I have set up my proofing profile in Aperture to match the printer and paper I'm using. When I print from Aperture I select my printer and paper in the colour sync profile, and in addition I ensure that the paper type is correctly specified in the printer's settings (and I also deselect colour managment in the printer settings).
    Does this sound right ? I've noticed that even just a small mistake, e.g. forgetting to select the paper type correctly, can lead to extreme colour differences.
    At the end of the day I'm not despertate for perfect colour in my home proofs, but I am trying to get them to look approximately right. It's not uncommon for me to end up with extreme colour problems. I can't print anything from iPhoto without it coming out too dark and with a blue tint. Luckily, printing from Aperture seems to produce better results (I just wish I knew why).
    Surely it shouldn't be this hard to set up a basic Epson photo printer on the Mac.
    If anyone knows of an idiot proof guide to home photo printing using high end applications on Mac OS X, feel free to point me in that direction.
    Paul

    I suspect it really is intricate as opposed to hard. But here's my "Dummies/Idiot's Guide ...." for you.
    The difficulties start by reminding ourselves that color is perceptual. Our retina sends a signal to our brain, and our brain translates that to a color. But, who knows what color you perceive as blue compared with myself if we both stand side by side and look up at a blue sky. we've just been told since a baby that it's blue, but our brain does it's magic and we "see" what it tells us. This translation issue between retina and perceived image is behind much color-blindness ... a difficulty in perceiving a color difference.
    Since we can't "standardize" our brains (well not anytime soon), what can we standardize that can reduce variance in our actual and perceived perception?
    Perception is 9/10's of the Law:
    Ever taken your laptop outside? When you can actually see the image due to the relative brightness of the outside to indoors, did you notice that colors seemed different? Your eye is adjusting to the ambient light, and your brain gets in on the act. Your brain decides that the brightest light source is essentially "white" and so tricks us. That's why we can take a photo inside under tungsten light, and what looked white to us as we took the shot comes out as yellow-orange. Quantum Physics time: Tungsten releases "light" (electromagnetic radiation) at this frequency when electrons that had been bumped up to higher energy states (by us supplying power from the on/off switch) fall back to a lower energy state and give off or 'emit" a packet of energy comprising the difference between those two states.
    Halogen headlights look brighter, but also whiter than tungsten headlights. That's because the radiation they emit is somewhat bluer. Xenon headlights are even more blue biased.
    The sun gives off light from a whole collection of different elements, but by and large it is yellow/red. However, there is lashings and lashings of it compared to a tungsten bulb, and our poor, overworked brain is left to cope figuring out brightness vs. whiteness. Our brains do OK, but they do it by tricking us rather than science.
    Home is where the heart of the problem is:
    So, OK, we've taken some photos, and pressed this button to "auto white balance" or selected a "white balance" that tells the camera that although white isn't really white, pretend that it is, since our brain is also pretending. Of course, if we forget to tell our camera this, we have to tell Aperture or PS CS2.
    But, sat there in front of our screen, what are we really seeing? Well, we are not seeing just the displayed image, no oh no. That would be too simple! No, our brains are passionate about their environment. What's the lighting? Fluorescent (I hope not), halogen, tungsten? This matters as our eyes/brain will calibrate to more than just the on screen image. What wall colors exist? Blue, red, green, off-white? Those refceted colors are going to fool our brain into believing that the image on screen has a tint. This is why Aperture's window is all gray, and photo professionals strongly suggest image editing is performed in an all gray room, with as "white" a light source as possible (halogen vs. tungsten, tungsten vs. fluorescent). BTW. I dislike fluorescents as all the bulbs seem to have hideously different colors, and age badly across time. That plus the rather unattractive greenish tints they give skin tones puts me over the edge.
    Oh, and no desklights with their nice pool of incident light or other effect lighting. Save that for the living room. This room is to reduce the trickery that your brain can throw at you. So, nice uniform, diffused lighting.
    Watching you watching me:
    But if we're now living in our nice gray world, ready to edit those wonderful images that we used the right white balance for when shooting, what next?
    Calibrating your monitor means you standardize against those who wrote a color profile for the printer, the paper or who will be printing images for you. Your image should look the same on someone elses monitor as it does on yours. That's step 1.
    However, displayed color is also perceptual. CRT's render color differently IMO to LCD's. Both are transmissive, but brightness differs and perhaps more importantly, what is color? Outside, our eye saw all the different wavelengths it was capable of sensing and passed the relative intensity values per wavelength to our brainiac computer. Not so in our digital scanner or camera. In computer technology, color is rendered as a triangular space represented by a dot at each apex ... one red, one blue and one green. Those point "phosphors" in CRT vary from manufacturer to manufacturer and to the standard required. Close but no cigar. The electronics and guns also do not track perfectly linearly from pure black (no signal) to pure white (max. output of a phosphor of equal intensity to the others). This is called gray-scale tracking and unless it is near perfect, you can see green or blue shifts in color at the black end or white end etc.
    Uh oh, that white question again. Come to that, how do I know it's the same white that I set my camera to when I shot? Well, we don't really wiothout setting to some standard. It's not that each phosphor isn't emitting, it's the balance across them at our determined highest brightness (white) that needs to be set. D65 is often quoted in TV's, representing a color temperature of 6500Kelvin (deepest reds are low temperature emmissions and brightest blues are the highest temperatures).
    Now LCD's don't have phosphors illuminated by a stream of electrons, and they came long after we had developed pretty decent CRT technologies. So being lazy humans, we lifted the ideas and terms No phosphors, but they do have red, green and blue LCD's (each a sub-pixel, and the three combined are a pixel)triggered by an electronic signal. so, why aren't they called LED panels? Well, LED's are not very bright, and we need a mechanism to make them brighter. Those quaint watches came to the rescue ... LCD's or Liquid Crystal Displays. You know, those ugly greeny/gray, low contrast watches. Yes, that's the one. Sandwich those colorful but dim LED's between an LCD, and use the LCD to switch on/off a powerful light ... rather light turbo charging a 4 cylinder motor to make it perform like a V8! The posh name was TFT-LCD (for Thin Film Transistor LCD). Now we have a bright, flat screen. Yahoo!
    But backlighting of the panel is not always very uniform (look at colors around your screen for different flat colors at different intensities and you may see patchiness). Nor do LCD's behave exactly like phosphors from deepest black (impossible when you have to have a back light which is always on and which illuminates the whole panel of glass) to white. But why sweat this, when the LCD rarely conforms perfectly to the red, green, blue phosphor standards.
    BTW, it is the backlight that kills laptop battery life, not the LCD's themselves. Turing your brightness down as low as possible helps .... but I digress.
    So we buy calibration hardware and software, and calibrate our monitor to a ruler flat grayscale from pure black to pure white.
    And it looks bad.
    It is rather idiosyncratic of us that a perfectly linear gray scale can leave us perceiving a lack of contrast. So, we distort the "gamma" value to provide more punchiness. Apple vs. Windoze computers tended to have different gamma's out of the box. Apple uses a gamma of 1.8, a rather flater, more pastel effect that, if my knowledge is correct, translates/translated better to the characteristics of the professional CMYK (Cyan, Magenta, Yellow, Black) four color printing processes used by offset litho printers. Windoze uses a gamma of 2.2, a punchier, gutsy, in-your-face effect. Marketing? I don't know. But it does appear a better match for RGB (our computer friendly Red, Green, Blue) inks used in inkjet printers.
    So we calibrate our monitors, and then deliberately decalibrate them (if you will) to correspond to our output destinantion.
    A quick digression here.
    If our output is destined for print, what dos that mean to us? Well, part is covered above. But what about web, or tv viewing from DVD? Ahh hah! Gotcha!
    We can control our calibration. We can even calibrate ourselves to external print shops, knowing that our image will appear 99% or more the same on their monitors as it does on ours. And they will have calibrated their monitors to their printers and paper (more on this below). But what about Joe Public?
    Back to that color space.
    A 10 year old color tv, used moderately over the years, performs no way like a new color tv. The phosphors "age." even the backlights in LCS panels age. Age is represented by diminished light output, and grayscale tracking. So, our 10 year old tv cannot represent the wide color space it could when it was brand new. Worse, even if we'd left our 10 year old tv in its box and just opened it, it would not be as capable as a brand new design. TV's are actually held down to 1950's standards rather than up for this very reasson, but the same is somewhat true of computer monitors. We don't know the age, quality or even the color calibration and room environment of our web browsers monitor. So, a much smaller "web safe" color space (sRGB ... standard - or small - RGB) was introduced. This restricted space should be renderable on most old monitors, though gross end consumer calibration issues will obviously remain uncontrollable.
    Meanwhile, we want to keep as big a color space as possible ... difficult to put back in what's been taken out. (Set your camera to "Adobe RGB" please right now.) Working in the biggest color space allows us to target any lesser color space with relative ease. And some of these restricted color spaces belong to printers ... which of course, differ from printer to printer, (probably more associtated with inks to inks) and paper to paper ....
    More on this next
    White points

  • TIFF/JPEG storage format

    Cheers,
    Using TIFF/JPEG-12 (Photoshop CS3/CS4) for long term image storage format  - are there any cons? Images will be in both RGB/CMYK/gray tagged/untagged and subsequently used in printed advertisements (layouted using InDesign)  - high image fidelity is not the goal.
    Thanks.
    Best wishes,
    Rasmus Olsen

    Gentlemen, allow me to explain:
    I have a partner with somewhat low bandwidth. This partner will receive images with layers/transparency and return images with layers/transparency. I started with lossless formats like PSD and TIFF/ZIP, but this takes way to long to upload/download. TIFF/JPEG seems to be the only feasible way to solve this. Besides, preliminary tests show no visible difference when comparing highres JPEG with PSD on printed paper.
    When I wrote cons I wasn't thinking of image quality degradation (JPEG is a lossy format - I allready know that). Obviously TIFF/JPEG is supported by Adobe and InDesign, but are there be any compatability issues regarding for instance TIFF/JPEG-embedded ICC's? Any possible trouble with TIFF transparency? Etc?
    BTW When working with advertisements you will inevitable receive untagged material. Later in the workflow these images will have a profile assigned.
    Best wishes,
    Rasmus Olsen

  • Jpeg converstion problem

    Hi,
    I opened up a JPEG, and obtained the pixel information using BufferedImage.getRGB(). Then I converted the pixel information in 32 bit integers.
    Then I wrote a class to read the string of bits and convert them into an array of integers (to turn into the equivalent JPEG image). I did a comparison of the two arrays (the one originally obtained from the 1st image and the one that I got from the string to turn into the second image. They were identical.
    Then using the second array and the JPEG encoder class, I created a JPEG, no problems. The two images look very similar, but they are different. the second image seems to have a different color range than the first. I assumed that if the pixel arrays were identical, I would get a JPEG that looked like my source. Am I miss understanding something?
    Basically I need to obtain the bit information from the JPEG (0s and 1s). Is there some way I can obtain bit information for the entire JPEG?
    Thanks,
    Jacob

    As long as your photo is small enough, it should go through Yahoo mail.
    How large is your JPEG?
    JPEGs directly from cameras are usually too large to e-mail without resizing.
    BTW, is this a Photoshop Elements or Premiere Elements question? You are on the Premiere Elements forum.

  • JAI - Colour problem converting GIF to JPEG

    Hi
    I'm using JAI to load a GIF, and then save it as a JPEG. When I save it (using the "filestore" operation in JAI.create(...) the resulting JPEG seems to be monochrome. However if I save the same image as a BMP, it's fine.
    I think this has something to do with ColorModels, but I'm a bit lost and confused really. Please could someone point me in the right direction?
    NB, because I can't get ImageIO installed on my machine (it refuses to believe I have the right JDK installed...) I'm restricted to methods available in JAI
    Thanks

    Thanks for the reply. Here's the complete solution for anyone whose interested (mostly copied from another post). I tested it and it works a treat for my app at least
    (image is a RenderedOp)
    BufferedImage realImage = image.getAsBufferedImage();
    try{
    BufferedImage rawImage = realImage;
        realImage = new BufferedImage(rawImage.getWidth(), rawImage.getHeight(), BufferedImage.TYPE_INT_RGB); //CHANGE THIS TO TYPE YOU NEED
        ColorConvertOp xformOp = new ColorConvertOp(null);
        xformOp.filter(rawImage, realImage);
    }catch(Exception e){
        e.printStackTrace();
    }

  • Colour problems saving Ilustrator file to pdf and jpeg (blacks go brown + some quality is lost)

    Hi,
    I was wandering id anybody could help me with a problem that has plagued me for a few projects now. I can't seem to find a solution.
    When I have a file in Illustrator that I want to save as or export as a PDF or JPEG whenever I save it the colours shift and the quality drops.
    Most noticiably black boxes goes to a muddy brown when saved to JPEGS, but I have also noticed tones in Photographs change quite a lot when saving as PDF.
    I have tried to tweek every type of setting there is. higher resoulution, compression, sampling, down sampling, PDF preset, print quality etc.but nothing seems to sort it out. PDF's arent as much as a problem as the JPEG but the only way I have managed to get a PDF up to a reasonable standard is by wacking everything up so there is no compression or downsampling which makes ginat files I cant email....
    Im sure the problem probably lies within the combination of each of these together but I cant seem to find out what that is.
    Has anybody else had this problem or know how to fix it? I have been searching blogs for so long?
    Thanks
    Leo
    (Before saving to JPEG)
    (After)
    Notice the black box with text in has turned a bit brown
    Also brown in the seat base has gone more orange and the whole picture has generaly lost quality.

    Leo,
    The file is CMYK Color Mode. Do you export to a CMYK JPEG or an RGB one?
    It is conceivable that the colour conversion of photographs (which are originally RGB) may cause the PDF issue.
    Obviously, you will have to choose a Color Mode. If (also) intended for print, the obvious choice is CMYK, but that often affects the appearance or artwork/images originally created in RGB.
    Colour management/settings and calibration may also be significant.

  • 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

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

Maybe you are looking for