Loading a raw image in BufferedImage

Hi guys,
I'm very new to java .I have a raw image which has 32 bit pixels which has ABGR...with alpha as the most signficant byte and the red as the least significant byte. I have an array of ints and I want to load this to a BufferedImage object. I then use a JPanel and render the BufferedImage on to it. I tried doing with other file formats like jpg , gifs and so the rendering to the JPanel works fine. But I'm not able to get the array of ints to be stored in BufferedImage correctly. Could you please let me know what I did was wrong or any suggestions?
Currently I have a class called RGBAImage that reads the raw image and stores it as an array of ints.
So in order to create a BufferedImage I do this roughly,
DataBufferInt buffer = new DataBufferInt(img.getPixels() , img.getPixels().length) ;
//                                                        bits  red                   green                   blue                 alpha
ColorModel cm = new DirectColorModel(32, (int)0x000000ff , (int)0x0000ff00 , (int)0x00ff0000 , (int)0xff000000) ;
SampleModel sm = cm.createCompatibleSampleModel(img.getWidth , img.getHeight) ;
WriteableRaster raster = Raster.createWritableRaster(sm , buffer , null) ;
BufferedImage bimg = new BufferedImage(cm , raster , false , null) ;Is this how its to be done? I am not getting the image drawn on the panel. Any suggestions or links?
Thank you
Siddharth

I have an array of ints and I want to load this to a BufferedImage object.In your sample code I cannot see how the int array you are talking about becomes the image data. Also, what is the img variable? Please provide a more complete code sample.

Similar Messages

  • Elements 11 and RAW IMAGES

    I had a Canon 400D and processing RAW images was not a problem before.
    However, since acquiring a Canon 70D, I cannot load my RAW images any more, for editing purposes.
    Can you help at all? Thanks in advance.

    For the 70d you need PSE12 Alternatively, download and install the free Adobe DNG converter to convert your raw files to the Adobe universal Raw format and the files will open in all versions of PSE (keep your originals as backups and for use in the camera manufactures software - Canon DPP on the software disk with your camera)
    Windows download (.exe file) click here DNG Converter 8.2
    Mac download (.dmg file) click here DNG Converter 8.2
    You can convert a whole folder of raw images in one click. See this quick video tutorial:
    You Tube click here for DNG Converter tutorial

  • Code to apply texture a raw image?

    i tried loading a raw image using the code i wrote below.
    can anybody please help me debug this code.
    i can only see a black and white strip on the entire screen with this.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.image.*;
    import java.awt.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import com.sun.j3d.utils.image.TextureLoader;
    import java.io.*;
    public class TexTry extends JFrame
         Image img;
         public static void main(String arg[])
              new TexTry();
         public TexTry()
              img=null;
              Container c=getContentPane();
              readImage();
              if(img==null)
                   System.exit(1);
              SimpleUniverse u=new SimpleUniverse();
              //c.add(u);
              BranchGroup bg=new BranchGroup();
              Background back=new Background();
              back.setApplicationBounds(new BoundingSphere( new Point3d(0.0,0.0,0.0), 200.0 ));
              Appearance app=new Appearance();
              Texture tex=new TextureLoader(img,this).getTexture();
              app.setTexture(tex);
              BranchGroup bgGeometry = new BranchGroup();
              Sphere sphere = new Sphere( 1.0f,
    Primitive.GENERATE_TEXTURE_COORDS |
    Primitive.GENERATE_NORMALS_INWARD, app );
              bgGeometry.addChild( sphere );
              back.setGeometry( bgGeometry );
              bg.addChild(back);
              u.addBranchGraph(bg);     
              //setSize(500,500);
              //show();
         public void readImage()
              try
                   FileInputStream f=new FileInputStream(new File("himg.raw"));
                   int size =f.available();
                   byte b[]=new byte[size];
                   f.read(b);
                   byte[] gray=new byte[256];
                   for(int i=0;i<256;i++)
                        gray=(byte)i;
                   ColorModel cm=new IndexColorModel(8,256,gray,gray,gray);     
                   img=createImage(new MemoryImageSource(640,480,cm,b,0,640));
              }catch(Exception e)
                   System.out.println("Error:"+e);

    Have you tried this code with another image that you know does work - just using a textureLoader to load in a gif or jpg for example? If the problem isn't with the loading then it is likely your viewPlatform is in a funny place or can't see the entire shape for one reason or another.

  • Loaded OMD raw pictures are over saturated

    Hi Gang:
    When loading a raw image from my beloved OMD the initial image shown (supposedly from the imbedded JPG)  is reasonably saturated. When loading is complete the image shown (now supposedly from the RAW) is significantly over saturated. Why would the imbedded JPG appear reasonably saturated, but the RAW loaded image be overly saturated? This must have something to do with how Aperture handles raw OMD files. RAW Fine Tuning does not seem to help with this. Any ideas?
    Thanks,
    Jeff Stulin

    Hi Jeff,
    Is your monitor calibrated?  With a hardware calibrator?  Which one?
    Do you have the most recent version of Aperture, and the most recent version of Apple's RAW converter (it is part of the OS; a new version came out this week)?
    What you describe as the process of drawing the Image on the screen is correct.  There is nothing "supposed" about it.
    The JPG that is shown is (usually) prepared by the camera.  It is possible that this image has been post-processed in-camera.  Do you have any PP settings applied when you record exposures?  Any "style" or anything else other than focus distance, focal length, ISO, aperture, and exposure duration?
    What do you have set in Aperture Prefs for using the in-camera JPGs?  (I don't have access to Aperture right now and can't tell which preferences tab this is on.)
    It is odd that you aren't seeing changes when you make changes using the RAW Fine Tuning Brick.  Nothing happens when you change the Hue Boost?  Are you recording RAW+JPEG, or just RAW?  If RAW+JPEG, which do you set as the Original (a/k/a "Master")?
    (Sent from my magic glass.)

  • IPad and RAW images

    Looking at the iPad specs it states it can import RAW images, but the RAW format is not listed in the viewable type of files. Has anybody tried loading a RAW image to the iPad and then view it?
    Thanks in advance.

    Here is an answer for you (basically 'no') from another posting:
    http://discussions.apple.com/message.jspa?messageID=11328583#11328583

  • Why can I not open raw images in bridge after down loading raw plug-in for my new Canon 70D?

    Why can I not open raw images in bridge after down loading raw plug-in for my new Canon 70D dozens of times?  I have never had any where near this amout of trouble with all my other Canon digital cameras. 
    <Removed by Moderator>

    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
    Mylenium

  • Loading raw images in java3d

    i am new to java3d, as u can very well know from my last question. i have loaded raw images in awt panels, but how can i do the same with java3d.
    please help me with one more question, if my image is very large, how can i pan through the image?
    also, if anyone can tell me what can i do with images that are not powers of 2?
    its my final semester project. please help me.

    i am new to java3d, as u can very well know from my
    last question. i have loaded raw images in awt panels,
    but how can i do the same with java3d.Use a simple plane in 3d space and put your image as texture on it.
    please help me with one more question, if my image is
    very large, how can i pan through the image?
    also, if anyone can tell me what can i do with images
    that are not powers of 2?
    Resize it. You could use the TexureLoader, which does a resizing afaik.
    its my final semester project. please help me.

  • Why won't Canon Raw images in IPad air photoroll NOT load into LightRoom Mobile ?

    Why won't Canon Raw images in IPad air photoroll NOT load into LightRoom Mobile ?
    I can import Canon Raw images from my s120 into the iPad Air's photo roll but then the import from photoroll into LightRoom Mobile collections fails.
    Any ideas on how to get this working ?
    Thanks,

    Raw import is not yet supported by Lr Mobile. You can vote for this feature request Lightroom mobile: Ability to import raw files

  • CS4 loading RAW images very slowly

    I just upgraded from CS2 to CS4 to support my new Canon 50D RAW file format. It is taking Photoshop about 12 seconds to open each file, and this is a real killer when running a batch. Is this typical with these huge 15MP images? I am running a 2.8Ghz machine on Windows XP and 2GB of RAM. My CS2 was very fast opening 8MP RAW images. Any insight on this is greatly appreciated.

    i am new to java3d, as u can very well know from my
    last question. i have loaded raw images in awt panels,
    but how can i do the same with java3d.Use a simple plane in 3d space and put your image as texture on it.
    please help me with one more question, if my image is
    very large, how can i pan through the image?
    also, if anyone can tell me what can i do with images
    that are not powers of 2?
    Resize it. You could use the TexureLoader, which does a resizing afaik.
    its my final semester project. please help me.

  • How can I best load RAW images from a Canon SX50?

    How can I best load RAW images from a Canon SX50?

    9Sorry, ........confused about this process.   When I attempted to Post the question I had entered, I was told a blank space could not be posted.  So, I reentered the Q in the "space"........ which apparently was the space for an answer....!! ??......)
    >  When I try to load RAW images taken by my Canon SX50 from the SD card, iPhoto 11 -  (iMac/OSX 10.6.8) tells me that it can't read the format or something like that.    OSX 10.6.8 came out before the SX50, thus, did not include the related program.           I want to shoot RAW on the SX50....... but I then want to load them into iPhoto....... which I do directly from pics I take with my Nikon D200.  
    Not sure if this will help.............

  • I cannot seem to load raw images into LR 2.5.  I've been using this for years.  I always load from memory card, but it gives me an unknown error message.  I tried to load from camera, hard drive, & external drive and still will not work.  I checked import

    I cannot seem to load raw images into LR 2.5.  I've been using this for years.  I always load from memory card, but it gives me an unknown error message.  I tried to load from camera, hard drive, & external drive and still will not work.  I checked import menu and nothing has changed.  I loaded the photos onto my tablet and images are fine, so do not feel it is the memory card.  Any thoughts?

    The error message probably said "unsupported or damaged"
    The T3 requires Lightroom 3.4.1 or later. You can either upgrade to a more current version of Lightroom (version 5.6 is the most recent) or you can use the free Adobe DNG Converter to convert the RAWs to DNG, which should import into Lightroom properly.

  • Need help with Elements loading RAW images since I switched cameras.

    I recently switched from a Canon Rebel XT to a Canon Rebel T1i. I have Elements 6.0 and was able to see RAW images with my old camera. For some reason the RAW images aren't loading in Elements now. I get a message saying the files are corrupt. I've tried different cards but still no difference. Any suggestions?

    Please read this TechNote:-
    http://kb2.adobe.com/cps/407/kb407110.html
    It shows at:-
    http://kb2.adobe.com/cps/407/kb407111.html
    you need at least ACR 5.4 for your T1i/500D
    ACR 5.6 and therefore earlier versions work on PSE 6.
    You should upgrade your PSE 6 to ACR 5.6; it does work on PSE 6 at least in WIndows. I know because ACR 5.6 works on my PSE 6 under Windows Vista.

  • My hardrive just got diagnosed as 'faulty' even though its only 1year8months old!!! I had adobe bridge installed on the computer with many picture files that included raw images. How can I get these raw files back after computer died?

    computer did not start up one day. it was a white screen
    took it to a mac bar and they said the diagnosis was a faulty hard drive
    I had backed up most of my images ( i am a photographer)
    had not backed up atleast 6 files full of raw images!!!!
    they suggested sending it to a data recovery specialist which would cost around $500!
    I am not getting the answers I need on how, why, or what is going to be recovered or if raw picture files will be able to be saved.
    Not sure what to do next because I dont have loads of extra money laying around to pay for something that should have not occured in the first place if I was actually sold a good computer.
    payed $1095 for this imac and it only lasted just under 2 years. I feel cheated and scammed! Has any one else gone through this same thing?? what did you do?

    If it is only 20 months old it is still covered by the 3-year Applecare.
    You did take out Applecare didn't you?
    I had backed up most of my images ( i am a photographer)
    had not backed up atleast 6 files full of raw images!!!!
    Why did you, as a photographer, not make several backups, not just one or a partial one, of your material?

  • Cannot Open Camera Raw Images in PS CR3

    Even though I've been a professional photographer for over 25 years, I finally decided it was time to go digital. Little did I know how overwhelming and frustrating the learning process would be, especially for an old timer like me. Well, the 10 day return period on the digital equipment and software purchase is up, so I have no choice but to move forward in the learning process. :)
    Actually, I'm excited about all the photographic possibilities that digital has to offer over film.
    The first batch of photos were taken with a new Canon 40-D in Raw + JPEG. When I open my picture folder (containing those photos) in Bridge, a CR2 icon appears next to each thumbnail image that was loaded from the camera flash card. The Bridge program is part of Photoshop CS3 that I purchased, and the 40-D has the latest firmware. (If relevant, the computer is a PC using Vista Home Edition.)
    Problem: When I double click on a JPEG image, I am able to load that image into Photoshop. When I double click on the CR2 icon, however, I get a message that says, "Could not complete your request because it is not the right kind of document." What am I overlooking?
    Also, shouldn't a thumbnail Raw image appear along with its corresponding JPEG thumbnail when the content of the picture folder is opened in Bridge? As it stands now, I get only a CR2 icon next to the JPEG thumbnails.
    I would be grateful for any help you could offer.
    Many thanks.
    Bruce

    Bruce,
    When I made the transition to digital some 8 years ago, I had tremendous help from a number of well documented websites, among which:
    http://www.luminous-landscape.com
    I think a lot of stuff there to get you seriously going. Another one is:
    http://www.computer-darkroom.com
    I sold all my film based stuff, except a Nikon F3 and a handful of lenses and a Paterson developing tank.
    The Nikon suspiciously smells like foam mirror damping strips chemically decaying.
    I sold my enlarger over the internet. The word "enlarger" caused me to be on SpamCops blacklist for a while.
    I'm in this since the seventies, and I think you'll be as amazed as I was at the possibilities and control you have. And no more bags with $300 worth of film that's consumed in one shoot.
    Jump in both feet! you won't be sorry. And these forums are the best help you can get.
    Good luck,
    Rob

  • Oversaturated RAW images in Lightroom 4

    All of a sudden, all of my RAW images are oversaturated and over contrasted in Lightroom 4.  When they are initially "loading" the photo looks great, but then when it loads the pictures it is WAY oversaturated and overcontrasted.  I have not changed any settings in Lightroom, so I am not sure what has happened.  I have attached screen shots to show it when it's loading and when it is loaded.  This is a HUGE difference.  All of my settings on the menu on the right are at 0 or whatever the original setting is in the Develop mode.  I've checked everything in the column on the right in the develop mode, settings, etc. I have checked to make sure that my Lightroom is not pending any updates and that my camera is up to date. I've looked in several forums.  From what I can see, there have been others with this issue, but I can never seem to find a resolution to fix it.  Any help would be greatly appreciated!!
    Camera: Nikon D7100 (if this matters)

    If something changed recently, it is likely one of:  you’ve recently shifted from shooting JPG to shooting RAW, a LR Preset being applied in Import, your LR defaults are different than before, your monitor profile is different, your video drivers have been updated, your video-card’s control-panel settings are different, or your monitor’s own settings are different.
    When you newly import an image are all the toning sliders still set to zero?  (i.e. Exposure, Contrast, …, Clarity, Vibrance, Saturaton)  A screenshot of the Basic panel at the top right of the Develop module would show this.
    What Profile do you have selected in the Camera Calibration area?  A screenshot of the bottom right of the Develop module would show this.
    To confirm whether your LR defaults have changed to something non-zero, you can make a virtual copy of a representative image and then click the Reset button and see if all the toning sliders return to zero in the Basic panel, and also check the Profile setting in the Camera Calibration area.
    If you want to upload that specific pumpkin image to http://www.dropbox.com/ and post a public download link to it, here, then others can load it on their systems and see what it looks like, to compare with your screenshots.
    So far the difference between the two screenshots appears to be camera-embedded JPG and default LR settings which will never be the same.  The 2nd (right) screenshot in your initial post also looks out-of-focus compared to the initial camera preview which seems odd.  Maybe things hadn’t fully-rendered, yet.

Maybe you are looking for

  • Jail in vsftpd 2.3.4-2 do not work properly... no idea why

    I have used the chroot_local_user=YES option in the vsftpd conf... (I have restarted it) But then I tried in filezilla accessing with a regular user, and its not jailed at all, I can see everything in the server... any idea? vsftpd 2.3.4-2 here the c

  • Getting "null" when trying to commit

    Dear All, am using Jdeveloper 11.1.1.3 ... i have a master-detail jsp page , i tried to insert a new row and when i commit the transaction ( press on the commit button ) nothing happen i mean the transaction is not saved and when i checked the log of

  • Getting an error after migrating VS2012 to VS2013 .

    Hi, I have installed VS2013 and opened my project. So web.config added "  <add assembly="System.Spatial, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />" and giving compile error : "Could not load file or assembly 'System.Spatia

  • Is it required to update statistics once new index is created

    Hi, oracle version: 8i i had created new index(size 0f 10g) on one table is it Required to update statistics immediately for the better execution plan. bash-2.05$ sqlplus "/as sysdba" SQL*Plus: Release 8.1.7.0.0 - Production on Sun Jan 4 19:00:26 200

  • Problem with website not loading images -

    www.gsmar.com is a real estate website that shows pics of homes for sale. After entering search criteria, you have a list of properties, and the images load on this page. When you click on a property, it should load the image of the home and you shou