BufferedImage Problem

This is kind of difficult to explain, but I'll do my best. It's a simple problem though.
So I have a class, let's call it ImagePanel. Quite simply, it's a panel that loads an image and then loads a BufferedImage from that image. It uses MediaTracker and the waitForID function to allow the image to load before drawing it to the panel.
That's fine and dandy. Works like a charm.
Now in this same class, I have a function that returns the BufferedImage, allowing it to be passed to other classes. The code is simply "return bImage;"
Now in one of my OTHER classes, it needs this BufferedImage to be passed into its constructor. This is done immediately at the beginning of the program. This is where my problem lied.
The BufferedImage would not load quick enough to pass it into the constructor of my other class, so it kept passing a null BufferedImage rather than the actual image.
Through trial and error, I fixed this problem with the following code:
BufferedImage bImage = ImagePanel.getBufferedImage();
          while (bImage == null)
               try
                    Thread.sleep(10); // Pause for a short moment to give bImage time to load
               catch (Exception e)
                    JOptionPane.showMessageDialog(null, "Error: " + e.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
               bImage = mapPanel.getBufferedImage(); // Try again
          }So if I slap a main function into the same class containing the code above, and create an instance of the class, and run it, it works fine, after a few seconds of loading (very inefficient program but that does not concern me for this project)
Now the main problem, and the reason I created this thread, is that when I create an instance of this class in ANOTHER class, it gets caught in an infinite loop at the above code.
However once again, if I simply make an instance of it in THE SAME CLASS, it works fine. What gives?

Alright, now I'm really confused. What would I need to change in the following class to change over to ImageIO?
I appreciate the help, I'm really frusterated at the moment.
public class ImagePanel extends JPanel
     private BufferedImage bImageEditable, bImageConstant;
     private Image image;
     private int id = 0;
     private boolean panelSized = false;
     public ImagePanel(String file)
          loadMap(file);
     public void loadMap(String file)
          Toolkit tk = Toolkit.getDefaultToolkit();
          image = tk.getImage(file);
          MediaTracker tracker = new MediaTracker(this);
          tracker.addImage(image,id);
          try      
               tracker.waitForID(id);
          catch (InterruptedException ie)
               JOptionPane.showMessageDialog(null, "Error: " + ie.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
     public void scaleImage(int w, int h)
          image = image.getScaledInstance(w,h,Image.SCALE_DEFAULT);
          MediaTracker tracker = new MediaTracker(this);
          tracker.addImage(image, id);
          try
               tracker.waitForID(id);
          catch (InterruptedException ie)
               JOptionPane.showMessageDialog(null, "Error: " + ie.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
     public void loadBImage()
          // Load editable image
          bImageEditable = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
          Graphics bImageEditableG = bImageEditable.getGraphics();
          bImageEditableG.drawImage(image, 0,0,null, null);
          // Load constant image
          bImageConstant = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
          Graphics bImageConstantG = bImageConstant.getGraphics();
          bImageConstantG.drawImage(image, 0,0,null, null);
     public BufferedImage getBufferedImage()
          return bImageConstant;
     public void paintComponent(Graphics g)
          super.paintComponent(g);
          if (!panelSized)
               scaleImage(getWidth(), getHeight());
               loadBImage();
               panelSized = true;
          g.drawImage(bImageEditable, 0, 0, image.getWidth(null), image.getHeight(null), null);
          g.drawString(territoryName, 10, getHeight() - 10);
}

Similar Messages

  • Problem with BufferedImage & "getGraphics()" / "createGraphics()"

    I try to create with a servlet a Graphics2D Object with the method "createGraphics()" from a BufferedImage Object. Therefore I use the following code:
    BufferedImage bufferimage=new BufferedImage(100,100,BufferedImage. TYPE_INT_RGB);
    Graphics2D g2;
    g2=bufferimage.createGraphics();
    With the Graphics2D Object I wanna draw into the BufferedImage Object:
    g2brut.drawLine(5,5,30,30);
    The servlet runs fine on a Windows-PC with Apache and Jserv. On a Linux-PC the same code doesn't work: The method createGraphics() creates a bug and the servlet doesn't run any longer.
    Hope someone could help!

    If there are no graphical components in your Linux system, like X-Windows or something, you don't have the capabilities to use the drawing package. AWT is system-dependent and without drawing routines on your system, you can't access drawing functions in Java. Assuming this is the problem, there's a package out there that gets around that by providing system-independent access to AWT. I've only heard of the problem, never faced it myself so I don't know exactly how to implement it, but my friend ran into the same problem and solved it this way.
    Here's the link: http://www.eteks.com/pja/en/
    Michael Bishop

  • BufferedImage display vs memory operations problems.

    Having some problems when working with BufferedImages.
    The problem:
    If I load a greyscale BufferedImage from a JPG on disk using
    currImage = ImageIO.read( this.currentImageFile);and display it on a JPanel using
         // Draw image on the current graphics context
                Graphics2D g2Start = (Graphics2D)this.panDisplayStart.getGraphics();
                g2Start.drawImage(ImageHandling.toBufferedImage(startImage),
                        null,
                        this.getCenteringPoints(startImage).x,
                        this.getCenteringPoints(startImage).y);I can now alter this image, say desiderate it as follows:-
    private void brightenDarken(BufferedImage anBuffImage, int aScaleFactor){
            float scaleFactor, tempFactor;
            tempFactor = (float)aScaleFactor;
            if(aScaleFactor >= 0)
                scaleFactor = (tempFactor/100) + 1;
            else
                scaleFactor = (tempFactor/100) * -1;
            RescaleOp op = new RescaleOp(scaleFactor, 0, null);
            finnishImage = op.filter(anBuffImage, null);       
            this.repaint();
        }Everything goes fine, this image is altered as expected.
    BUT, if I do not first display this image, but load it into memory, and apply the same transformation in memory, when I display the image it is all bright reds and blues?
    Can anyone help, I have a feeling this it might be something to do with the imageType property or perhaps the colorModel.
    I�m on a tight deadline on this one, and any help or suggestions would be really appreciated.

    Hi
    I am loading a jpg file using
    currImage =
                        ImageIO.read( new FileImageInputStream(this.currentImageFile));where the currentimageifile is a path to a jpg image.
    I notice that when i look at the colormodel off the 'currImage' vairable loaded this way I get:-
    ColorModel: #pixelBits = 24
    numComponents = 3
    color space = java.awt.color.ICC_ColorSpace@9931f5 transparency = 1
    has alpha = false
    isAlphaPre = false
    though when I look at the colorModel of the image that I load and display firts before processing I get:-
    DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0
    ??? Many thanks.....

  • 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

  • Parsing Problems? ImageIcon and BufferedImage

    Hi to everyone
    Could I ask if I will to send ImageIcon with BufferedImage as its arguement. Then what should I receieve from the server? ImageIcon only or ImageIcon with BufferedImage as its arugement?
    Any help will be appreciated. Thank You.

    I am sending ImageIcon over to the server, hence the server will receive as ImageIcon.
    However, when I want to pass the ImageIcon which being parse to Image, this step is ok. Lastly when I want to parse the Image to BufferedImage image, I am encountering parsing problems, hence could u advise me further.
    The error message "Receiving failed: java.lang.ClassCastException"
    Any help will be appreciated. Thank You.
         public void getImage()
              //Object input = null;
            Image images = null;
              try{
                   imgIcon = (ImageIcon)oin.readObject();
                   System.out.println("Icon Width: "+imgIcon.getIconWidth());
                   while((images = imgIcon.getImage()) != null)
                        System.out.println("Images Width: "+Image.getWidth(images));
                        BufferedImage bimage = (BufferedImage)images; // PROBLEM LIES HERE
                        System.out.println("Bimage Width: "+bimage.getWidth());
                        ImageServerConnection.writeImage(bimage, "happy.jpg");
                        //String fname = "joalicia";
                        //create an new folder to store those sent images.
                        //File f = new File ("c:\\Sweet", fname);
                        //create(f);
              }catch(Exception e){
                   System.err.println("Receiving failed: "+ e);
         }

  • GetBlue() problem with BufferedImage

    hi i have an bmp image that i want to know the blue color component for the first pixel of the pixel array i create from the image
    the problem i have is that the pixels[0]=-10718816 and i get an "IllegalArgumentException --> More than one component per pixel", i thing is because the number should be between 0 and 255. but im not really sure...
    please some one help me.
    i just need to get the blue color component from the first pixel of an pixels int array from image loaded with BufferedImage
    BufferedImage img = null;
    String pix="";
    //here i load the image into the BufferedImage
    img = ImageIO.read(new File("C:\\1sierra.bmp"));
    //here i load the intArray with the rgb pixels of my BufferedImage
    int[] pixels = img.getRGB(0,0,img.getWidth(),img.getHeight(),null,0,img.getWidth());
    //here i try to get the blue color component and i get the exception
    pix =Integer.toString(img.getColorModel().getBlue(pixels[0]));

    You want to use a bit-wise AND and not the MOD operator.
    public class TryInt
         public static void main( String[] args )
              int               i = 0xFFFFFFFF;
              System.out.println( i & 0xFF ); // output: 255
              System.out.println( i % 255  ); // output: -1
    }The most significant byte of an RGB int value often holds the Alpha value which is typically 0xFF.
    Edited by: careysb on Nov 21, 2009 9:43 PM

  • Problems sending bufferedimages through a socket

    Hi everyone,
    I've got a server program that takes a screen capture as a bufferedimage, and sends it through a socket to be saved by the client program. The programs work fine, however, whenever I'm transferring the image with the code at the bottom of this post, I notice that the collision LED on my network hub flashes and I can't figure out why (Obviously there's a collision, but I don't know what causes it or how to stop it from happening). I've googled a bit for collisions and bufferedimages, but have come up with El Zilcho. I've also gone through the IO tutorial and the Socket and BufferedImage API's, but havent learned anything to solve my problem.
    Also, As it is now, if I want multiple images, I need to disconnect and reconnect repeatedly. I tried sending multiple bufferedimages throught the socket, but get the following exception:
    java.lang.illegalargumentexception:  im == null!Does anyone know of a way where I can send multiple bufferedimages through the socket without reconnecting every single time? Thanks
    Server code:
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Dimension screenSize = toolkit.getScreenSize();
    Rectangle screenRect = new Rectangle(screenSize);
    Robot robot = new Robot();
    BufferedImage image = robot.createScreenCapture(screenRect));
    ImageIO.write(image, "jpeg", fromClient.getOutputStream());
    fromclient.shutdownOutput();
    fromclient.close();Client code:
    BufferedImage receivedImage = ImageIO.read(toServer.getInputStream)
    toServer.close();Any help would be greatly appreciated. TIA
    Jay

    Have you tried.
    ImageIO.write(image1, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image2, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image3, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image4, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image5, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image6, "jpeg", fromClient.getOutputStream());
    ImageIO.write(image7, "jpeg", fromClient.getOutputStream());

  • Problem with BufferedImage.getScaledImage()

    I have som problems with BufferedImage.getScaledImage().
    When called from a servlet on my (small) linux server (redhat 7.2 on i586)
    Here is the top of the exeption stack.
    java.lang.NoClassDefFoundError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:130)
         at java.awt.Toolkit$2.run(Toolkit.java:712)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:703)
         at java.awt.Image.getScaledInstance(Image.java:129)
         at Admin.newbegadd(Admin.java:172)
    Could this depend on missing modules in my Linux installation???
    Any ideas welcome.
    /Mattias

    It sounds as though you're running a headless system...see if this helps:
    http://www.java4less.com/faqs.htm#F14

  • BufferedImage update problems!!

    Hi,
    I'm trying to create my very own little game :o) like micro machines for fun.
    I am using a JLayeredPane with the background / track image as the bottom layer (extended JPanel) and the cars / bikes (extended JLabel) within the level above. I am trying to draw any movement by the bikes/cars within a BufferedImage and then blatting it to the screen upon the next frame update.
    The Problem!!
    When I was just drawing the image directly into the Graphics it worked fine - in the sense that the screen refreshed correctly. However now that I have modified it to use a global BufferedImage and Graphics2D,
    firstly I get a black area around the bike / car image
    secondly when the view does refresh - if the car has moved - some of the black is being left "marking" the background image :o(
    The following are the only lines in the car / bike paintComponent() method:
    super.paintComponent(g); //paint background
    // put the correct image into BufferedImage Graphics2D
    myGraphics.drawImage(image[(rotate/30)],null,this);  
    // Draw BufferedImage to the screen.  
    g.drawImage(myImage, 0, 0, null);The following is the background paintComponent() method:
    super.paintComponent(g);       
    g.drawImage(tracks,0, 0, this);Can someone please explain / help in any way???
    Cheers
    Glenny

    how about:
    GraphicsConfiguration defaultConfiguration;      // Used to get best image.
    Graphics2D offGraphics;                // Tool for drawing off-screen image.
    Graphics onGraphics;                // Tool for drawing on-screen image.
    BufferedImage offScreen;
    super(false);
         defaultConfiguration = GraphicsEnvironment.
         getLocalGraphicsEnvironment().getDefaultScreenDevice().
         getDefaultConfiguration();
         offScreen = defaultConfiguration.createCompatibleImage(
         WINDOW_WIDTH, WINDOW_HEIGHT);
         offGraphics = offScreen.createGraphics();
    public void paint(Graphics g) {
    g.drawImage(offScreen, 0, 0, this);
    and draw everything to the offGraphics then...
    offGraphics.drawString("Micro Machines",300,200);
    paint(onGraphics);

  • Problem in creating BufferedImage

    Hi all,
    I'm trying to create a BufferdImage object from a byte array. which has the pixel values of a Gray scale image (8 bits per pixel).
    This is the code, I am trying with..
        private ColorModel colorModel;
        private SampleModel sampleModel;   
        private int bitsPerPixel;   
        private int numBands;   
        public BufferedImage convertImageDataToImage(byte[] data)
            if (bitsPerPixel == 8)
                numBands = 1;
                int[] bandOffsets = new int[numBands];
                for (int i = 0; i < numBands; i++)
                    bandOffsets[i] = numBands - 1 - i;
                sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                    width, height, numBands, numBands * width, bandOffsets);
                if (ImageUtil.isIndicesForGrayscale(data, data, data))
                    colorModel = ImageUtil.createColorModel(null, sampleModel);
                else colorModel = new IndexColorModel(bitsPerPixel, data.length,
                    data, data, data);
            DataBuffer db = new DataBufferByte(data, width * height);
            WritableRaster wr = Raster.createPackedRaster(db, width, height,
                bitsPerPixel, new Point(0, 0));
            Hashtable ht = new Hashtable();
            ht.put("", "t");
            BufferedImage bi = new BufferedImage(colorModel, wr, false, null);
            return bi;
        }I'm getting the following error while executing the above code
    Exception in thread "main" java.lang.IllegalArgumentException: Raster sun.awt.image.SunWritableRaster@1bd0dd4 is incompatible with ColorModel IndexColorModel: #pixelBits = 8 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@d70d7a transparency = 1 transIndex   = -1 has alpha = false isAlphaPre = false
         at java.awt.image.BufferedImage.<init>(Unknown Source)Error occurs at..
    BufferedImage bi = new BufferedImage(colorModel,wr,false,null);
    Could any one please help me, what is the wrong here..
    Thanks and Regards
    Ramesh

    any one knows the root cause?
    Edited by: Rameshkumar.Ramasamy on Feb 22, 2008 5:10 PM

  • Problem accessing BufferedImage innards.

    I'm using the following method to load and draw an image, then take the raw pixel data in ABGR format. Unfortunately, what I get out at the end, when I print the array in full, is nothing but zeroes. I think this was the method recommended in one of the Java game developer FAQs I read, so the 'principle' should be sound. Anyway, if you have any clues as to where I'm going wrong, let me know.
    //contents is an Image, T is a Toolkit.  x and y are static ints.
      private byte[] loadImage(String filename) {
        contents = T.getImage(filename);
        x = y = -1;
        while(x < 0) {
          x = contents.getWidth(this);
          y = contents.getHeight(this);
        BufferedImage buffer = new BufferedImage(x, y, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics g = buffer.getGraphics();
        g.drawImage(contents, 0, 0, this);
        byte data[] = ((DataBufferByte)(buffer.getRaster().getDataBuffer())).getData();
        System.out.println(data.length);
        return data;
      }Much obliged.

    I'm not completely sure I have my facts straight here, but I'm pretty sure that Toolkit.getImage returns instantly, having only -started- the loading of the image. Similarly, Graphics.drawImage only draws the portion of the image that is available, and also returns instantly whether it could complete the drawing or not. (This annoying quirk is the purpose for the annoying ImageObserver parameter in the drawImage method. Note: I always pass "null" here instead of "this". Actually, I think the loading itself doesn't even begin until the image is first used!)
    Consider using a MediaTracker object to wait until the image is finished loading. For example:Image img = getImage("picture.gif");
    MediaTracker mt=new MediaTracker(this);
    mt.addImage(img,0);
    try { mt.waitForID(0); } catch(InterruptedException e) {} // This waits for it to loadAlternatively, you can use the javax.swing.ImageIcon class to load the image, since it automatically waits until it has a complete image before it returns. For example:Image img=new javax.swing.ImageIcon("image.gif").getImage();

  • Problems with BufferedImage

    Hi, i'm very new to Java.
    What I'm trying to do is process the individual pixels of an image. So far I have the following code:
         BufferedImage inputImage;
         public void loadImage()
              try
                   File input = new File("face.jpg");
                   inputImage = ImageIO.read(input);
              catch (IOException e)
                   JFrame frame = new JFrame();
                   JOptionPane.showMessageDialog(frame,
                  "File input Error!","Error", JOptionPane.ERROR_MESSAGE);
         }This loads the Image, from a jpg.
    Next I am trying to get the color data from an individual pixel so I tried this:
         int[] pixels =
                      img.getRGB (5, 5,img.getWidth()-5,img.getHeight()-5,null, 0,img.getWidth()-5);
              JFrame frame = new JFrame();
              JOptionPane.showMessageDialog(frame,
             "" + (int)pixels[1],"PixelColor", JOptionPane.ERROR_MESSAGE);However it always gives me a Coordinates out of bound exception, I am pretty sure img.getWidth() is returning the actual width of the image
    if i put in a small values say (5 ) for width and height and scan size it does return something but it looks like gobbeldy gook -16734 does not seem like an actual pixel value!
    Also I have another question how do I println to the console? Thanks
    Salik

    Yes I have verified that getWidth and getHeight return the proper height width of the image.
    here's the actual error:
    java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
         at sun.awt.image.ByteInterleavedRaster.getDataElements(Unknown Source)
         at java.awt.image.BufferedImage.getRGB(Unknown Source)
         at pixelFlow.processImage(pixelFlow.java:31)
         at pixelFlow.run(pixelFlow.java:89)
         at acm.program.Program.runHook(Program.java)

  • Problem with IconImage for JFrame

    If I create an BufferedImage by ImageIO.read for example and then call getScaledInstance on this image and set the scaled Image to a JFrame as the IconImage (via setIconImage(Image image)), the application hangs.
    Has anyone else this problem?

    ok ok, i read it and now think that this is a sscce:
    import java.awt.Image;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public class Start
         public static void main(String[] args)
              final JFrame frame = new JFrame();
              final Image image, imageScaled;
              try
                   image = ImageIO.read(new File("test.png"));
                   imageScaled = image.getScaledInstance(8, 8, Image.SCALE_DEFAULT);
                   frame.add(new JLabel(new ImageIcon(image)));
                   //frame.setIconImage(image); works
                   frame.setIconImage(imageScaled); // works not
                   frame.pack();
                   frame.setVisible(true);
              catch (IOException e)
                   System.err.println(e.getMessage());
                   e.printStackTrace(System.err);
    }

  • Image processing with BLOBS: how to write BufferedImage to a BLOB

    Hi everybody - thanks in advance for any input on that topic.
    I'm doing image processing using AWT and 2D. Images are stored in a RDBMS as BLOB Type, which I get using JDBC and convert to a BufferedImage using a JDBCImageDecoder.
    Now, I have my BufferedImage and I can process them using the appropriate filters (ConvolveOp e.g.)
    Writing the BufferedImages to disk or display on screen is easy. But I can't get to write them to a BLOB Object. Any Hint ?
    (Of course, I'm speaking of oracle.sql.BLOB objects, not java.sql.Blob).
    Thanks and have a nice day

    Billy,
    Thank you for your answer. I have two questions.
    First what that means "Bob's your uncle ?" I'm a french man, not used to english special sentences ou jargon. Would enjoy to know !
    Second, I have created a PL/SQL procedure to update my table. I face a problem.
    I want to initialize b_lob with the img_blob value but I get an error : "ORA-22922: nonexistent LOB value". WHere do my error comes from ? I am fairly new in this stuff of BLOB.
    Below my procedure.
    Thank for your kind help.
    Christian.
    create or replace
    procedure insert_img as
    f_lob bfile;
    b_lob blob;
    loops number default 0 ;
    lines number default 0;
    stmt varchar2(4000);
    cursor c1 is select img_blob, file_name, pk from photos FOR UPDATE ;
    begin
    NULL;
    dbms_output.enable(900000);
    stmt := 'SELECT COUNT(*) FROM PHOTOS';
    EXECUTE IMMEDIATE stmt INTO LINES ;
    for ligne in c1 loop
    exit when loops >= lines ;
    loops := loops+1;
    update photos set img_blob= empty_blob() where CURRENT OF C1;
    -- return img_blob into b_lob;
    b_lob := ligne.img_blob ;
    f_lob := bfilename( 'MY_FILES', ligne.file_name );
    IF (DBMS_LOB.FILEEXISTS(f_lob) != 0)
    THEN
          DBMS_OUTPUT.PUT_LINE('BFILE exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
          dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
          dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
          dbms_lob.fileclose(f_lob);
          dbms_output.put_line('ligne.pk :' || ligne.pk || ', lines : ' || lines || ', loops ' || loops);
      ELSE
        DBMS_OUTPUT.PUT_LINE('BFILE does not exist: '|| ligne.file_name || ', ligne :'|| ligne.pk);
      END IF;
    end loop;
    commit;
    end insert_img;

  • Getting rgb values from BufferedImage

    BufferedImage.getRGB(int x, int y) returns the colour of an image pixel as an integer. My problem is that i need the seperate red/blue/green components of this. Does anyone know how I can get these?
    Thanks.

    I've done that before but cant actually remember howe to go about it ... but here is an idea that should work
    Color TEMP = new Color(BufferedImage.getRGB(int x, int y)) ;
    Now to extract each component just use the methods getRed() getGreen() and getBlue() on TEMP.
    Does it make sence to you?
    If it does work let me know, just out of curiosity!
    Rui

Maybe you are looking for

  • Cannot view RT system in browser

    Related to this RT problem. I cannot get my RT system to work. Everything is identical to a known-good working system I finished a month ago. Same hardware, SW (2011) (2011RT) etc. Identical hardware in identical slots in the chassis. I can see the h

  • Windows Vista 64 and Z22

    I have been reading the messages, and gather that the only, or prefered way for me to sync my Z22 to my new Vista 64 bit computer is through Bluetooth.  However, my Z22 is only configured for IR.  What equipment do I need to buy, and how do I set up

  • My roommates' computers can't get a signal from my Airport base station

    I just bought a used Airport Extreme (the round one) off Craig's List and set up a network in my apartment using Airport Utility on my MacBook. I've set it up with WPA, and I can connect to it. Works great.... Until my roommates try to connect from t

  • Google map in dashboard

    Hello, tnanks in advance for your help. I have already make a ticket at metalink3 but i am starting to believe that the people there are .....(other time) Let's start.... I put in a narrative view a sample code that i found in a blog,i change it a li

  • Statement trigger

    When do we use statement triggers? i need one practical example... like row level triggers help in audit or journalling. Plz reply asap.