Create an image from Component

I have created an ImageLoader that stores images loaded from the filesystem. I do however need a default image that is not reliant on loading an image from the filesystem, in case any images on the filesystem are not found.
I have tried to use Components createImage() method, until I read that this can only be used if the Component is visible on screen, which my Component never will be.
What I really want is a grey rectangle as an ImageIcon by what means I get this I'm not bothered,
hopefully someone can help

Use the java.awt.image.BufferedImage class. To create a BufferedImage object, no component need to be visible. Here is some sample code:       BufferedImage image = new BufferedImage(wid, ht, BufferedImage.TYPE_INT_RGB);
       Graphics2D gc = image.createGraphics();
       gc.drawRect(x,y, width, height);Note that BufferedImage is a subclass of Image. So, you can create ImageIcon from a BufferedImage object.
If you don't want to use BufferedImage, an option would be to create the image from an array of bytes.

Similar Messages

  • Create an Image from a Component

    Can anybody tell me how to create an Image from a Component?
    I intend to create an Image from a JTable now but I want to have a more generic solution of course to be able to create an Image from any Java / Swing component (Applet, JList, JButton, ...).
    Thank you,
    Dirk

    2 ways:
    1) java.awt.Toolkit.createScreenCapture(Rectangle bounds)
    2) This:
         public static BufferedImage grabByPaint(Component comp) {
              boolean visible = comp.isVisible();
              // if not visible, need to make visible to make sure sizes are correct. 
              if(!visible) {
                   comp.setVisible(true);
              Dimension size = comp.getSize();
              BufferedImage bi = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g2d = bi.createGraphics();
              comp.paintAll(g2d);
              if(!visible) {
                   comp.setVisible(false);
              g2d.dispose();
              return bi;
         }

  • Creating an image from a Mac and restoring it in another Mac

    Hi,
    I've spent a couple of hours trying to make a copy of one of my macminis, trying to copy it in another macmini to have the SAME machine "duplicated".
    I've read some tutorials online, but something is going wrong....
    First of all, I went to my "master" macmini, DiskUtility, create new image from folder, select my macintosh HD and I created the image of the whole HD.
    Almost a hour after, the image was created.
    Then I moved the .dmg to a USB drive, and I connected the USB pen to the machine that I want to be a "clone" of the master. There, I opened Disk Utility, Restore, I selected the Source image from my USB, but I can't selected (=drag) the Macintosh HD into the "destination" field...
    What I'm doing wrong?
    Thanks, any help is appreciated :))

    Hi sr.richie;
    If you are booted from Macintosh HD then the system will not allow this cloning operation to take place. You must boot from another disk in order to do that.
    Allan

  • How to create an image from another one with midp1.0 as in midp 2.0

    hi:
    we can create an image from part of another one in midp2.0 width the following method
    createImage(Image image, int x,int y,int width,int height,int transform)
    but have to work with midp1.0, then how?
    regards

    but i have six icons in one picture, (tow row ,three column, each size 14*14)
    it's ok to get the top-left icon with the following code
    Image image = Image.createImage("/myicon.png");
    Image tmp = Image.createImage(14, 14);
    Graphics g = tmp.getGraphics();
    g.drawImage(image, 0, 0, Graphics.TOP|Graphics.LEFT);
    but how to get other icon?
    regards

  • [SOLVED] How to Create an Image from UTF8 Text via Command-line

    As the title points out, I'm trying to create an image from unicode text via command line. I tried...
    convert -pointsize 48 -size 400 caption:测试用 text.png
    But that results in question marks for the Chinese characters. So searching around online I discovered that I needed to specify a font which could display the characters. The characters show up just fine in Firefox, KDE, Kate, Terminal, etc so I know I have a font which can render them. I thought it might be DejaVu but this also resulted in question marks...
    convert -font /usr/share/fonts/TTF/DejaVuSerif.ttf -pointsize 48 -size 400 caption:测试用 text.png
    Any ideas?
    Last edited by tony5429 (2011-01-31 23:17:41)

    DejaVu doesn't contain those Chinese glyphs at all, so please don't blame ImageMagick for not rendering them.
    So, Firefox, Kate, Terminal and the others you stated to use DejaVu, if encounter these characters, fall back to some other fonts to render them. These fonts are, however, not vector, but bitmap fonts. (This can be seen if you increase text size (Ctrl++ in Firefox): the Chinese characters don't change, they remain of their inherent size.)
    Actually, e.g. /usr/share/fonts/misc/18x18ko.pcf.gz definitely contains the three example characters, so the mentioned apps may use this font as fall back.
    Apparently ImageMagick doesn't handle bitmap fonts (I'm not sure), so you won't be able to hit your original target. Anyway, since you tried to parse "-pointsize 48", you wouldn't be satisfied with the font size.
    Your only choice seems to be using the above mentioned CJK-approved TTFs.
    EDIT: typo
    Last edited by barto (2011-01-28 21:52:33)

  • Getting error while creating Service controller from component controller

    Hi,
    I have added CAF model in used model for DC project.But when i m trying to create service controller from component controller by selecting used model it is giving error like "Context element cannot be bound to model layer".
    Can anybody help me out on this issue.
    Thanks in advance.

    Hello,
    try to check the check box in MS Word - File - Options - General - "Open e-mail attachements and other uneditable files in reading view"
    I am not sure how this option really works, but I think you will find it checked. So try to uncheck it.
    Or wise versa :c)
    Kind regards

  • Create still images from video files?

    from http://gadgetwise.blogs.nytimes.com/2009/04/16/5-new-photoshop-tips-for-photographers/ , "You can now preview video in Bridge and create still images from video files."
    I just installed the 5.4 Camera Raw Update.
    I can preview the AVI files from my Nikon D5000, but have not figured out how I might create a still image ( other than stopping the movie, and dragging to copy ) Have tried searching adobe, this forum, have not found more info ion this.

    Stop the video at the desired point, press the Shift, Command, and 4 keys, drag the cursor so that the whole picture is highlighted, let go of the button, and open the PNG on the desktop.
    (35300)

  • Create transparency image from shape

    Hi,
    I'd like to create the application that create the transparency image from drawing data. the code is as follows.
    BufferedImage img = new BufferedImage(350,350,BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = img.createGraphics();
    GeneralPath gp = new GeneralPath(GeneralPath.WIND_NON_ZERO);
    gp.moveTo(100,100);     gp.lineTo(100,200);
    gp.lineTo(200,200);     gp.lineTo(200,100); gp.closePath();
    g2.setPaint(Color.yellow);
    g2.fill(gp);
    g2.setStroke(new BasicStroke(2));
    g2.setPaint(Color.red);
    g2.draw(gp);
    File outFile = new File("outimg.png");
    ImageIO.write(img,"png",outFile);
    I can create the image from such code, but the image is not transparent since the background is all black. What additional coding I need to make it transparent?
    Thanks,
    Sanphet

    1. use a PixelGrabber to convert the image into a pixel array
    2. (assuming pixel array called pixelArray) :
    if (pixelArray[loopCounter] == 0xFFFFFFFF) { //assuming the black your seeing is not a fully transparent surface
        pixelArray[loopCounter] = pixelArray[loopCounter] & 0x00FFFFFF; //sets alpha channel for all black area to 0, thus making it fully transparent
    }3. recreate an Image using MemoryImageSource
    I'm sure there is a quicker solution using some built in java functions...but hey, I dont' know it!! :)
    Here's a sample class that utilizes these techniques:
    * To start the process, click on the window
    * Restriction (next version upgrade) :
    *     - firstImage must be larger
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class AdditiveBlendingTest extends javax.swing.JFrame implements MouseListener, ActionListener, WindowListener {
        static final int ALPHA = 0xFF000000; // alpha mask
        static final int MASK7Bit = 0xFEFEFF; // mask for additive/subtractive shading
        static final int ZERO_ALPHA = 0x00FFFFFF; //zero's alpha channel, i.e. fully transparent
        private Image firstImage, secondImage, finalImage; //2 loades image + painted blended image
        private int firstImageWidth, firstImageHeight, secondImageWidth, secondImageHeight;
        private int xInsets, yInsets; //insets of JFrame
        //cliping area of drawing, and size of JFrame
        private int clipX = 400;
        private int clipY = 400;
        //arrays representing 2 loades image + painted blended image
        private int[] firstImageArray;
        private int [] secondImageArray;
        private int [] finalImageArray;
        //system timer, used to cause repaints
        private Timer mainTimer;
        //used for double buffering and drawing the components
        private Graphics imageGraphicalSurface;
        private Image doubleBufferImage;
        public AdditiveBlendingTest() {
            firstImage = Toolkit.getDefaultToolkit().getImage("Image1.jpg");
            secondImage = Toolkit.getDefaultToolkit().getImage("Image2.gif");
         //used to load image, MediaTracker process will not complete till the image is fully loaded
            MediaTracker tracker = new MediaTracker(this);
            tracker.addImage(firstImage,1);
         try {
             if(!tracker.waitForID(1,10000)) {
              System.out.println("Image1.jpg Load error");
              System.exit(1);
         } catch (InterruptedException e) {
             System.out.println(e);
         tracker = new MediaTracker(this);
         tracker.addImage(secondImage,1);
         try {
             if(!tracker.waitForID(1,10000)) {
              System.out.println("Image2.gif Load error");
              System.exit(1);
         } catch (InterruptedException e) {
             System.out.println(e);
         //calculate dimensions
         secondImageWidth = secondImage.getWidth(this);
         secondImageHeight = secondImage.getHeight(this);
         firstImageWidth = firstImage.getWidth(this);
         firstImageHeight = firstImage.getHeight(this);
         //creates image arrays
         firstImageArray = new int[firstImageWidth * firstImageHeight];
            secondImageArray = new int[secondImageWidth * secondImageHeight];
         //embeded if statements will be fully implemented in next version
         finalImageArray = new int[((secondImageWidth >= firstImageWidth) ? secondImageWidth : firstImageWidth) *
                 ((secondImageHeight >= firstImageHeight) ? secondImageHeight : firstImageHeight)];
         //PixelGrabber is used to created an integer array from an image, the values of each element of the array
         //represent an individual pixel.  FORMAT = 0xFFFFFFFF, with the channels (FROM MSB) Alpha, Red, Green, Blue
         //each taking up 8 bits (i.e. 256 possible values for each)
         try {
             PixelGrabber pgObj = new PixelGrabber(firstImage,0,0,firstImageWidth,firstImageHeight,firstImageArray,0,firstImageWidth);
             if(pgObj.grabPixels() && ((pgObj.getStatus() & ImageObserver.ALLBITS) != 0)){
         } catch (InterruptedException e) {
             System.out.println(e);
         try {
             PixelGrabber pgObj = new PixelGrabber(secondImage,0,0,secondImageWidth,secondImageHeight,secondImageArray,0,secondImageWidth);
             if (pgObj.grabPixels() && ((pgObj.getStatus() & ImageObserver.ALLBITS) !=0)) {
         } catch (InterruptedException e) {
             System.out.println(e);
         //adds the first images' values to the final painted image.  This is the only time the first image is involved
         //with the blend
         for(int cnt = 0,large = 0; cnt < (secondImageWidth*secondImageHeight);cnt++, large++){
             if (cnt % 300 == 0 && cnt !=0){
              large += (firstImageWidth - secondImageWidth);
             finalImageArray[cnt] = AdditiveBlendingTest.ALPHA + (AdditiveBlendingTest.ZERO_ALPHA & firstImageArray[large]) ;
         //final initializing
         this.setSize(clipX,clipY);
         this.enable();
         this.setVisible(true);
         yInsets = this.getInsets().top;
         xInsets = this.getInsets().left;
         this.addMouseListener(this);
         this.addWindowListener(this);
         doubleBufferImage = createImage(firstImageWidth,firstImageHeight);
         imageGraphicalSurface = doubleBufferImage.getGraphics();
        public void mouseEntered(MouseEvent e) {}
        public void mouseExited(MouseEvent e) {}
        public void mousePressed(MouseEvent e) {}
        public void mouseReleased(MouseEvent e) {}
        public void windowActivated (WindowEvent e) {}
        public void windowDeiconified (WindowEvent e) {}
        public void windowIconified (WindowEvent e) {}
        public void windowDeactivated (WindowEvent e) {}
        public void windowOpened (WindowEvent e) {}
        public void windowClosed (WindowEvent e) {}
        //when "x" in right hand corner clicked
        public void windowClosing(WindowEvent e) {
         System.exit(0);
        //used to progress the animation sequence (fires every 50 ms)
        public void actionPerformed (ActionEvent e ) {
         blend();
         repaint();
        //begins animation process and set's up timer to continue
        public void mouseClicked(MouseEvent e) {
         blend();
         mainTimer = new Timer(50,this);
         mainTimer.start();
         repaint();
         * workhorse of application, does the additive blending
        private void blend () {
         int pixel;
         int overflow;
         for (int cnt = 0,large = 0; cnt < (secondImageWidth*secondImageHeight);cnt++, large++) {
             if (cnt % 300 == 0 && cnt !=0){
              large += (firstImageWidth - secondImageWidth);
             //algorithm for blending was created by another user, will give reference when I find
             pixel = ( secondImageArray[cnt] & MASK7Bit ) + ( finalImageArray[cnt] & MASK7Bit );
             overflow = pixel & 0x1010100;
             overflow -= overflow >> 8;
             finalImageArray[cnt] = AdditiveBlendingTest.ALPHA|overflow|pixel ;
         //creates Image to be drawn to the screen
         finalImage = createImage(new MemoryImageSource(secondImageWidth, secondImageHeight, finalImageArray,
              0, secondImageWidth));
        //update overidden to eliminate the clearscreen call.  Speeds up overall paint process
        public void update(Graphics g) {
         paint(imageGraphicalSurface);
         g.drawImage(doubleBufferImage,xInsets,yInsets,this);
         g.dispose();
        //only begins painting blended image after it is created (to prevent NullPointer)
        public void paint(Graphics g) {
         if (finalImage == null){
             //setClip call not required, just added to facilitate future changes
             g.setClip(0,0,clipX,clipY);
             g.drawImage(firstImage,0,0,this);
             g.drawImage(secondImage,0,0,this);
         } else {
             g.setClip(0,0,clipX,clipY);
             g.drawImage(finalImage,0,0,this);
        public static void main( String[] args ) {
         AdditiveBlendingTest additiveAnimation = new AdditiveBlendingTest();
         additiveAnimation.setVisible(true);
         additiveAnimation.repaint();

  • Unable to create Disc Image from DVD

    I get the following error when trying to make a copy of a family wedding DVD. I'm using Disc Utility and creating the image as a DVD/CD master (.cdr) file. It gets to about 3/4 of the way and then gives the following error.
    The internal drive is a PIONEER DVD-RW DVR-K05
    Sep 10 22:13:24: Disk Utility started.
    Creating Image “Wedding of xxx & xxx.cdr”
    Reading VOLUME_IDENTIFIER (Apple_UDF : 0)...
    Unable to create “Wedding of Sarah & Federico.cdr” - Input/output error.
    I've tried twice now and the same error. Looks like I might have to use Toast/Popcorn etc?
    Thanks,
    Darren
    iMac G5 2.1GHz 1Gb RAM 260Gb HDD   Mac OS X (10.4.7)  

    I do not know what that error means. However, if you open up the Disk Utility & go into it's Help Menu & in the search field type duplicating a CD or DVD. There you will find detailed instructions on how to create a disc image from a DVD.
    Good possibility your answer may be found there and/or there may have been something you missed in creating a disc image.
    Good luck.

  • System Image Utility 10.6.3 - fails when creating NetBoot image from DVD

    System Image Utility 10.6.3, trying to create a NetBoot image from a bundled installer disc that came with a 27" Late 2009 iMac (iMac11,1). Image creation fails consistently, since the image that System Image Utility creates is only 901M.
    Anyone see this before?
    Don
    --------- System Image Utility log ----------
    Workflow Started (2010-06-16 14:03:02 -0700)
    Starting action: Define Image Source
    Finished running action: Define Image Source
    Starting action: Create Image
    Starting image creation process...
    Create NetBoot Image
    Initiating NetBoot from Install Media.
    Creating working path at /Library/NetBoot/NetBootSP0/NetBoot of Mac OS X Install DVD
    Creating disk image (Size: 901 MB)
    Finalizing disk image.
    created: /Library/NetBoot/NetBootSP0/NetBoot of Mac OS X Install DVD/NetBoot.dmg
    Attaching disk image
    Installing to destination volume
    2010-06-16 14:03:38.126 installer[2365:6f03] Looking for system packages
    2010-06-16 14:03:38.129 installer[2365:6f03] no system packages found
    2010-06-16 14:03:38.130 installer[2365:6f03] No or Invalid system receipts found on /private/tmp/mnt.LjFArn
    2010-06-16 14:03:38.130 installer[2365:6f03] Attempting fallback using: /System/Library/PrivateFrameworks/SystemMigration.framework/Resources/FallbackS ystemFiles.plist
    2010-06-16 14:03:38.175 installer[2365:6f03] Finding system files...
    2010-06-16 14:03:38.619 installer[2365:6f03] Writing system path cache.
    2010-06-16 14:03:38.623 installer[2365:6f03] Error writing cache to /private/tmp/mnt.LjFArn/Library/Caches/com.apple.FindSystemFiles.plist
    2010-06-16 14:03:38.625 installer[2365:6f03] Failed to enumerate /tmp/mnt.LjFArn/Library/Caches, cannot prune (
    "com.apple.userpictureCache"
    installer: Package name is Mac OS X
    installer: Installing at base path /private/tmp/mnt.LjFArn
    installer: The install failed (There is not enough space on this disk to install the selected items. Deselect at least 6.46 GB and try again.)
    Script is done.
    NetBoot creation failed.
    Image creation process finished...
    Stopping image creation.
    Image creation failed.

    Brian Nesse wrote:
    Hi Don, here's my guess...
    The 901 number is additional space added in the scripts. This indicates that the source image size was 0.
    Since you are making a NetBoot from Install media, under the covers the installer process is being run to create a NetBoot volume. The media shipped with the 27" iMac is most likely CPU specific and thus the installation fails because you are trying to create the image (i.e. install the system) on an unsupported CPU.
    In order to produce a NetBoot from the install media, you'll have to create it on the 27" iMac.
    Hi Brian,
    Thanks for the response. This makes perfect sense. I'll give this a try and shout back!
    Thanks,
    Don

  • Create an image from float array?

    Dear All,
    I have a float array containing pixel values. From that array I want to create an image (let's say in JPEG format).
    How should I do that?
    thanks

    Hi musti168,
    You're going through your entire image pixel-by-pixel and getting each of their values - why don't you just use the IMAQ ImageToArray function?  
    On this forum post I found an example of IMAQ ArrayToImage: http://forums.ni.com/t5/LabVIEW/IMAQ-arraytoimage-​example/td-p/68418
    You can use some of the IMAQ Image Processing palette to change the image to gray scale - possibly a threshold.
    Julian R.
    Applications Engineer
    National Instruments

  • Can iDVD create disc images from VIDEO_TS folder, and burn them?

    That first question is pretty self-explanatory.
    Background is this: I've downloaded some video folders/files from forum/torrent trading websites. When finished, I have a VIDEO_TS folder, often an EXTRAS_TS folder as well. A while back, I downloaded the app DVD IMAGER to create a disc image. Yesterday that stopped working effectively, so maybe I need to re-download, but I was wondering if there's just a better way? I also downloaded the app called BURN, but can't see yet how that creates disc images.
    Once I create that disc image, I need to burn it, and I was using Disk Utility for that. I'm really looking for some help and advice on the best way to perform these processes.
    Thank you, and let me know if I need to post in another forum.

    Additionally, do you have experience w/ DVD Imager?
    Nope. Like I said, Roxio's Toast Titanium is the top application (and is probably the one that most experienced people use).

  • Problem creating an image from a remote url

    I am creating a servlet which does the following:
    1. retrieves an image from a remote url
    2. resizes the image
    3. sends the image to the client.
    The servlet works fine when I run it on my PC, but when I run it on the server, it doesn't. Here's the problematic code
        private Image getRemoteImage(String imageUrl) throws Exception {
            System.err.println("in getRemoteImage()");
            if (!imageUrl.startsWith("http://")) imageUrl = "http://" + imageUrl;
            URL u = new URL(imageUrl);
            System.err.println("imageUrl: " + imageUrl);
            HttpURLConnection huc = (HttpURLConnection) u.openConnection();
            huc.setRequestMethod("GET");
            System.err.println("connecting...");
            huc.connect();
            System.err.println("Getting DataInputStream...");
            DataInputStream in = new DataInputStream(u.openStream());
            //DataInputStream in = new DataInputStream(huc.getInputStream());
            System.err.println("...got");
            int numBytes = huc.getContentLength(); //1063
            System.err.println("numBytes: " + numBytes);
            byte[] imageBytes = new byte[numBytes];
            System.err.println("reading fully...");
            in.readFully(imageBytes);
            System.err.println("...read");
            in.close();
            System.err.println("creating imageIcon");
            ImageIcon imageIcon = new ImageIcon(imageBytes);  //   <-- problem here
            System.err.println("** THIS LINE IS NOT REACHED **");
            System.err.println("creating image");
            Image image = imageIcon.getImage();
            System.err.println("returning image");
            return image;
        }When I access the servlet with FF, the browser reports:
    The image �<my servlet url>� cannot be displayed, because it contains errors.
    When I access the servlet with IE, I get:
    Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Servlet execution threw an exception
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:429)
         at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:495)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.NoClassDefFoundError
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:141)
         at java.awt.Toolkit$2.run(Toolkit.java:748)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739)
         at javax.swing.ImageIcon.(ImageIcon.java:205)
         at myservlets.GetImage.getRemoteImage(GetImage.java:283)
         at myservlets.GetImage.processRequest(GetImage.java:73)
         at myservlets.GetImage.doGet(GetImage.java:394)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:429)
         at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:495)
         at java.lang.Thread.run(Thread.java:534)
    Any ideas?
    Cheers,
    James

    Cheers rebol.
    I've tried that (along with all other kinds of techniques I never knew existed). I think it might be a problem with the Tomcat setup - it may need to run headless (sounds a bit severe!...).

  • Is it possible to create an image from part of a png image???

    i have an image and i want to create 4 indivdual image from it in which they could be combined to reform the image that i have

    Its actually quite easy, first you create a new blank image the size of the section you need, then you draw the larger image onto the new image so that the section you want starts at the top left corner of the new image. I use the code below, which works fine.
    Image image = Image.createImage("/myimage.png");
    int width = [whatever the width of the new image is];
    int height = [whatever the height of the new image is];
    int x = [x position of where your image section starts];
    int y = [y position of where your image section starts];
    //Creates a new Blank Image where we will draw our
    //section on to
    Image imageSection = Image.createImage(width, height);
    Graphics g = imageSection.getGraphics();
    //set the clip
    g.setClip(0,0, width, height);
    //Draws our larger image onto our new image
    g.drawImage(image, -x, -y, g.TOP|g.LEFT);

  • IPhone SDK: How to create an image from raw data

    Creating a UIImage from some form of bitmap file format is easy, whether you let UIImage load the file itself or create it with an NSData. But what if you have raw bitmap data in memory and you want to create an image?
    In Cocoa NSBitmapImageRep can be created by passing it a pointer to a block of memory and the relevant heigh, width, bit depth etc. information. From that you can easily create an NSImage. There doesn't seem to be anything equivalent on the iPhone. CGImage can be created but it looks like you have to write a CGImageProvider. CGBitmapContextCreate takes a void * to a block of memory. Does it clear that block?
    Is there a good way to do this?

    ElNono wrote:
    You can't do RGB565 on a CGImageRef/CGContextRef. The only 5bpp modes supported are 1555 ARGB or 5551 RGBA. If you just need to display the image, use OpenGL. One of the supported texture formats is RGB565. If you need to save the image then you're going to have to pre-convert it to RGB888.
    hi ElNono , i have test the RGB888 data now , the image can show , but another problem is the image just like serveral picture over lap together , also is blurred , my code is here:
    const size_t width = 1024;
    const size_t height = 768;
    const size_t bitsPerComponent = 8;
    const size_t bitsPerPixel = 32;
    const size_t bytesPerRow = (bitsPerPixel * width)/8;
    CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    NSString *imagePath = [[NSBundle mainBundle] pathForResource: @"Test" ofType: @"rgb"];
    NSFileHandle* file = [NSFileHandle fileHandleForReadingAtPath:imagePath];
    NSData* imageData = [file readDataToEndOfFile];
    CGContextRef context = CGBitmapContextCreate((void*)[imageData bytes], width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
    CGImageRef imageRef = CGBitmapContextCreateImage (context);
    UIImage*rawImage = [UIImage imageWithCGImage:imageRef];
    CGColorSpaceRelease(colorSpace);
    CGContextRelease(context);
    CGImageRelease(imageRef);

Maybe you are looking for

  • Change BSEG-ZUONR  during the Post Goods issue.

    Hi We wanted to Update the BSEG-ZUONR with sales Order no( traverse back to the Original SO during reversal)  ( Basically Assignment field (ZUONR) in the Accounting side) after performing the Post Goods issue  USING TRANSACTION VL02N. Is there any us

  • Memory problem restoring all my songs into vista

    I have a desktop where i have all my songs in itunes, 7300 songs, 7 dvds, and i just purchased a laptop with 3 gigs of ram and i took my 7 dvds and while put my songs into my laptop in itunes, 90% thru the 3rd dvd the cd popped out and box came up st

  • Every time i try to mach contact a picture the phone app crushes

    Also if i try from the pictures app or even from the whatsapp the apps crush when i try to mach a contact picture

  • 10.1002 supply memory error

    I have replaced all of the colors with HP brand toner, i have made sure all orange tabs pulled, I have turned the machine off and back on.  I have switched the cartridges around and it still shows the error in the magenta slot (with a ?)  it also sho

  • Canceled but not received yet

    i canceled my item is apple airport express with Order Number: W277258486 in march 11 2011. i received email with notification about canceled items, but now, i've not received return yet!!! plz help me!!!