Saving an image froma a Canvas

Hello,
I'm a beginner. I've created an application wich uses a native procedure, myFunc(), wich paints an image over a Canvas.
But now I want to create an Image from each frame that is painted over this Canvas. The paint method is like this one:
public void paint(Graphics g) {
   Rectangle r = this.getBounds();
    Image image = this.createImage(r.width, r.height);
    Graphics g = image.getGraphics();
    this.paint(g);
    try {
       ImageIO.write((RenderedImage)image, "png", new File(name));
   } catch(IOException ioe) {
}It works, but it just saves a gray image, such if no image were rendered to the Canvas. What's going wrong? Thank you

Sorry, I've changed some parts of the code for making it more comprenhensive. The correct one is:
public void paint(Graphics g) {
   Rectangle r = this.getBounds();
    Image image = this.createImage(r.width, r.height);
    Graphics g = image.getGraphics();
    this.myFunc(g);
    try {
       ImageIO.write((RenderedImage)image, "png", new File(name));
   } catch(IOException ioe) {
myFunc(g) is the native funcion

Similar Messages

  • Saving an image from a Canvas

    Hello,
    I'm a beginner. I've created an application wich uses a native procedure, myFunc(), wich paints an image over a Canvas.
    But now I want to create an Image from each frame that is painted over this Canvas. The paint method is like this one:
    public void paint(Graphics g) {
       Rectangle r = this.getBounds();
        Image image = this.createImage(r.width, r.height);
        Graphics g = image.getGraphics();
        this.paint(g);
        try {
           ImageIO.write((RenderedImage)image, "png", new File(name));
       } catch(IOException ioe) {
    }It works, but it just saves a gray image, such if no image were rendered to the Canvas. What's going wrong? Thank you

    Sorry, I've changed some parts of the code for making it more comprenhensive. The correct one is:
    public void paint(Graphics g) {
       Rectangle r = this.getBounds();
        Image image = this.createImage(r.width, r.height);
        Graphics g = image.getGraphics();
        this.myFunc(g);
        try {
           ImageIO.write((RenderedImage)image, "png", new File(name));
       } catch(IOException ioe) {
    myFunc(g) is the native funcion

  • Saving an image from Image Field

    Hello all!
    I am working on a form for someone with a certain request.
    I am wondering if images from the Image Field can be saved? I tried right clicking on the image but no menu pops up so I am looking for other options. Are there any ways to work around this?
    Thanks in advance!

    Hi radzmar,
    Thanks for the reply. If any scripting was involved, would it be pretty lengthy/complex?
    Thanks again! Any information helps

  • Saving multiple images from a PDF to use later

    How can I save individual images from a PDF to use later?  I would like to be able to save them in a separate folder?

    When you open the pdf, you'll see the import pdf window. Just click the Images radio button, then select the images you want to open in PSE, and then save them in the editor:

  • Saving jpg images from mail to iPhoto

    To save a jpeg image from Mail to iPhoto does no longer work. When you in Mail click the small save button, next to the attachment count , and command Save to iPhoto, the jpeg does not come up in iPhot as supposed ! This worked fine previoulsy but apparently due to some of the updates now

    Mountain Lion: tallennus ei välttämättä onnistu suoraan Mailista iPhotoon

  • Saving an Image from a url

    I need to write a simple(even dos based) app that saves an image from a url (ie http://www.google.com/images/logo.gif) into c:\temp\*filename*
    thanks alot for the help

    Its just like reading/writing a regular file. Check out the 'Custom Networking" tutorial found on this page:
    http://java.sun.com/docs/books/tutorial/

  • Saving multiple images from

    Are there any updated functions or apps that would allow you to save multiple images from a text message to camera roll from iphone? If not, what are the best alternatives these days?

    Some apps, like Mail allow you to do this but others do not. Tap on photo and a list of choices comes up. In Mail one of the choices is to Save X Photos where X equals the number of photos in the email. I've never received more than one photo in a text so I'm not sure if this same choice will appear there.

  • Saving still images from videos

    Hi, how do I save a still image from a video clip?

    You can do this with a free app called MPEG Streamclip.
    Detailed instructions are here at this link.
    https://discussions.apple.com/docs/DOC-3231

  • How to extract an image from a canvas ?

    Hello there,
    I have a picture loaded in a Canvas, and I would like to save it to a file.
    Here's what I have:
    NireCanvas can = new NireCanvas();
    back_image = JAI.create("fileload","c:\\inaxio\\Default.jpg");
    buf_back = back_image.getAsBufferedImage();
    public class NireCanvas extends Canvas
    public void paint(Graphics g)
              Graphics2D g2d = (Graphics2D)g;
              g.drawImage(buf_back,0,0,null);
    public void button_save_imagen_click()
         try{
              Rectangle r = can.getBounds();
              Image img = can.createImage(r.width,r.height);
              Graphics g = img.getGraphics();
              ImageIO.write((RenderedImage)img, "png", new File("c:\\temp.png"));
         } catch(Exception err){System.out.println("arazoa gordetzereakoan.");}
    the back_image is displayed on the canvas correctly, but when I try to get the image, all I get is a plain png image, which has the same size of the canvas and the same color of the canvas but without the picture (it's grey).
    I display the img on another frame, and the img is grey too.
    I think that something is missing in my code. I have tried lots of things and always with the same result. Does somebody know what I'm doing wrong ?
    thanx for helping! inaxio

    Rectangle r = can.getBounds();
    Image img = can.createImage(r.width,r.height);
    ImageIO.write((RenderedImage)img, "png", new File("c:\\temp.png"));That code creates a new blank image and saves it to a file. That's whats wrong. Shouldn't buf_back be used in there somewhere? The fact that it is present in paint() doesn't help in this context.

  • Saving an image from an email

    Hey i had one question, when i get email with a picture in it and I download the image is that image saved to my pre or is it just saved to the email? And if it is saved to the pre how can i view it outside of the email
    Post relates to: Pre p100eww (Sprint)

    If the image is an attachment, you should be able to tap on the attachment and you'll see a button that says "Save to Photos" which will do that.
    http://kb.palm.com/wps/portal/kb/na/pre/p100eww/sprint/solutions/article/43841_en.html#N05E2BEA8.05D...
    If the image is embedded in an HTML email (it's not an attachment), which is what I think you're asking about, I don't think you can save it.
    But! A clever person on PreCentral figured out a workaround - use your two fingers to zoom way in to the picture, then take a screenshot. 
    How do you take a screenshot?
    Hold down Orange + Sym + P at the same time. You won't get any visual confirmation that a screenshot has happened, but when you open the Photos app, it will appear under a new category called "screenshots."
    (cite: http://forums.precentral.net/general-webos-chat/189360-how-hell-do-i-save-pictures-email.html)
    OR, you can just open up the email on your desktop computer, save the image as a file on your desktop, and then email the image as an attachment to yourself, open the email on your Pre, tap the attachment, and get that "Save to Photos" button mentioned earlier.

  • IPhone SDK: Saving an image from the camera rotates it

    When I use an image retrieved from the camera and try to save it to the disk, it always looks rotated -90 degrees. Anybody else have this problem? Or know what's going on? What's the easiest way to just rotate it 90 degrees?
    <code>
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *writablePath = [[paths objectAtIndex:0] stringByAppendingString:@"/newImg.jpg"];
    NSData * imageData = UIImageJPEGRepresentation([UIImage imageWithCGImage:cameraImage,1);
    if (imageData != nil) {
    [imageData writeToFile:writablePath atomically:NO];
    </code>

    Hi - I've found this post that might describe a similar (or same?) issue.
    http://discussions.apple.com/thread.jspa?messageID=7936896&tstart=0
    Hope that helps. You've gotten much farther than me - I'm still trying to figure out how to capture camera images using the SDK for a personal photo application. I couldn't find any mention of it in the UIImage Class Reference. Do you know where I might find docs on how to do it?
    Thanks

  • Saving .png images from Photoshop for FCP

    Is it best to save them as Interlaced or Progressive?
    They are for import into Final Cut Pro, then exported as part of a motion menu for use in DVD Studio Pro.
    Will one option give better quality over another?
    The project is SD PAL.

    Marc Morris wrote:
    One thing that's confusing me is some button boxes I've made up for DVDSP.
    They don't look the same thickness in FCP yet they are identical in Photoshop. It's very annoying!
    Might be because they are not sitting exactly on a scan line, so a top or bottom edge is getting cut off.
    Try moving the suspects up or down slightly.
    Do you have a thin, surrounding edge on them? Make it a little bit thicker.

  • Saving images from facebook...low-res? Please help

    Hi. I'm working on our school's yearbook through walsworthyearbooks' online design. I saved an image from facebook that we need, but it turns out incredibly small and pixelated. Walsworth staff can't help me.
    I put the image in photoshop, and it looks to be a normal size, and is not pixelated. the image I'm trying to put in right now is 400X474 pixels and I changed the resolution from 72 to 150 on photoshop.  I've tried PNG and JPEG.
    What can I do? I even tried taking a screenshot of the image on facebook so that it wouldn't be saved directly from facebook. The image fits the entire screen, so I don't know why it would turn out so small and messy when put into an online designer.

    Put a link to the facebook image here. If the image on facebook is 400px by 474pixels the image should print quite well as a portrait sized around  2" x 2.37"  for 200 DPI should be good for a yearbook image.

  • How to generate 300 DPI image from canvas using Imagesnapshot

    Hi all,
    I want to generate image from my canvas.
    I tried using bitmapdata and imagesnapshot.
    Bitmapdata has no property called DPI.
    Imagesnapshot allows to set DPI but it is not generating 300 dpi image.
    Any idea?

    You are in the Using iPhone forum. I will ask the hosts to move this to the iPad forum. However, I'm not aware of any setting change you can make to the cameras in the iPad or iPhone.

  • When saving an image in PS CS 6, and going back to Lightroom 5. The original image and the edited image are at the end of the line up.

    I'm using a Mac, Lightroom 5 and Photoshop CS 6. I've started having an issue with the line up in Lightroom 5 after saving an image from PS CS 6. For some reason when I save the edited image form CS 6 it's taking the edited image and the original image and putting it at the end of the line up in Lightroom. If I take the edited image and move it to the right of the original it will put both of them back in the line up where they should be. How do I fix this. I've been looking in the menu for some kind of setting  with no luck.

    Change the sort order. View->Sort

Maybe you are looking for

  • CNTL_ERROR while calling a function module from Java webdynpro

    I am calling a RFC function module from javawebdynpro app which inturn calls a function module performing BDC on CAPP transaction. When I run this from SE37 of the same system or a different system everything works fine. But when called from Java web

  • Blank screen no external display

    My satellite is less than one year old. On start, screen is blank, external display does not work. Potentially motherboard issues. This appears to be common. Will they pay money back instead of repairing and returning the.horrible product? It may bre

  • Development of Form for Returnable and Non-returnable material Gate pass

    Dear Experts, I am working with an Indian client impementing SAP PM. I need help in developing a form for Returnable and Non Returnable Gatepass. Requirements are below; RGP/NRGP should be made for all materials going out of the factory, irrespective

  • Web Reports configuration

    Hi! I have a question about web reports, exactly what I need for getting the report on web... Is it necessary a Web server???? Is it ITS necessary??? Thanks a lot

  • Still msg tone Error exists in ios 5.1.1

    i have noticed aftr more thn around 8 to 10 days of extensive use, the msg tone gets kinda repeat itself in a line thrice for just one message.. thn the only thing which helps is a restart.. hav anybody knows about this error ??? "fyi : i do know how