Trying to create an image and save it on file system

Hi,
I'm trying to create an image and save it in the file system :
     public static void main(String[] args) {
     int wid = 632;
     int hgt = 864;
     BufferedImage bufferedImage = new BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
     bufferedImage.getGraphics().setColor(Color.black);
     bufferedImage.getGraphics().drawOval(30, 30, 100, 100);
          bufferedImage.getGraphics().drawString("test me one two three",2,2);
          bufferedImage.flush();
try {
               ImageIO.write(bufferedImage,".bmp",new File("C:/MyImage.bmp"));
     } catch (IOException e) {               
               e.printStackTrace();
THE PROBLEM : It creates C:/MyImage.bmp on my file system, but the file is empty (size 0).
Am I missing something ?
Thanks

Try changing ".bmp" to "bmp". If that fails, try posting an SSCCE.
Edit 1:
And in future, please use the code tags when posting code, code snippets, HTML/XML or input/output. To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.
Edited by: AndrewThompson64 on Aug 3, 2009 1:23 AM

Similar Messages

  • Upload attachements from Windows and Save them to File System

    Hi
    We are upgrading to 11.5.10, using Database 10g r2. Can any one help me to upload attachement from a PC and save to a Unix file system instead of database. We are using forms 6i. Please help.

    Hi
    We are upgrading to 11.5.10, using Database 10g r2. Can any one help me to upload attachement from a PC and save to a Unix file system instead of database. We are using forms 6i. Please help.

  • I am trying to create a folder and save it onto my desktop but apparently I do not have permission to do so. How can I change this?

    I am trying to figure out how to create a folder on my desktop. For some reason, my desktop folder is no longer available and whenever I try to set one up, an alert states that I do not have permission to create one. I don't know what to do.

    I think you need to repair user directory permissions.  Follow these instructions:
    http://osxdaily.com/2011/11/15/repair-user-permissions-in-mac-os-x-lion/

  • How do I take an object from an image and save it so I can use it in other images?

    I am trying to figure out how to take an object from an image and save it so I can re-use it again in other pictures?  I know how to use the magic wand to select the object and place it in a blank image.... but I do not know how to re size the selected object or keep it for later use.  Basically I would like to use the object the same way that I use the graphics ... so I guess I am wondering if there is a way that I can make my own graphics... I have Elements Photoshop 13.  Thanks for any help/advice....  Jerrie

    Hi Jerrie,
    You can re-size using Transformation tool. Ctrl + T will give you a box to re-size the image or object.
    You can save these object as PNG file with Transparent layer. You can use these objects later in another projects.
    Regards,
    Sandeep

  • AppleScript to resize images and save with new name

    I want to make an apple script, which resizes all images of a folder regardless what kind of filetype.
    The source folder will change every day.
    With the script i want to choose a source Folder, resize all images and save the files with my jpeg options in the same folder, but with adding  „_ipad“ in the filename.
    I tried to edit an existing script from this forum, but in Photoshop 5.1 i get the error-message "This function is possibly not available in this Version" in line 18 "save in file newFileName as JPEG with options myOptions"
    How can i save the documents with new name in the existing folder?
    Thanks.
    This is the script i’m working with:
    set inputFolder to choose folder with prompt "Wähle einen Ordner:"
    --set destinationFolder to choose folder with prompt "Wähle einen Zielordner" as string
    tell application "Finder"
              set filesList to (files of entire contents of inputFolder) as alias list
    end tell
    tell application "Adobe Photoshop CS5.1"
              set UserPrefs to properties of settings
              set ruler units of settings to pixel units
              repeat with aFile in filesList
      open aFile showing dialogs never
                        set docRef to the current document
                        tell docRef
                                  set newFileName to my getBaseName(name)
      --resize image height 240 resolution 72 resample method bicubic sharper
      change mode to RGB
      resize image resolution 72
                                  set myOptions to {class:JPEG save options, embed color profile:true, quality:12, format options:progressive, scans:3}
      save in file newFileName as JPEG with options myOptions
                        end tell
      close the current document saving no
              end repeat
              set ruler units of settings to ruler units of UserPrefs
    end tell
    on getBaseName(fName)
              set baseName to fName
              repeat with idx from 1 to (length of fName)
                        if (item idx of fName = ".") then
                                  set baseName to (items 1 thru (idx - 1) of fName) as string
                                  exit repeat
                        end if
              end repeat
              return baseName
    end getBaseName

    This seems like a Photoshop error not an AppleScript one. Have you looked in the Photoshop dictionary to see if the command you are getting the error on exists and if it has those options?
    If all you want to do is resize image files and save the resized image file you might want to look at Automator. Specifically the Scale Image action under Photos.
    regards

  • SuperImpose two images and save it as a single image[urgent]

    Hello..
    Can anyone tell me how do we superimpose two images and save it as a single image.The image on the top is smaller in size in my case.
    Please Help..

    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    class TwoBecomeOne {
        public static void main(String[] args) throws IOException {
            BufferedImage large = ImageIO.read(new File("images/tiger.jpg"));
            BufferedImage small = ImageIO.read(new File("images/bclynx.jpg"));
            int w = large.getWidth();
            int h = large.getHeight();
            int type = BufferedImage.TYPE_INT_RGB;
            BufferedImage image = new BufferedImage(w, h, type);
            Graphics2D g2 = image.createGraphics();
            g2.drawImage(large, 0, 0, null);
            g2.drawImage(small, 10, 10, null);
            g2.dispose();
            ImageIO.write(image, "jpg", new File("twoInOne.jpg"));
            JOptionPane.showMessageDialog(null, new ImageIcon(image), "",
                                          JOptionPane.PLAIN_MESSAGE);
    }

  • HT201177 I am trying to create home movies and each time there is no sound when I play back the disc. The sound is there when I play back in imovie and also after I've shared with idvd and played back. Not sure what else to do???

    I am trying to create home movies, and do not have sound on the final disc. The sound is there in imovie and after sharing to idvd. This has only happened a couple of times before and I have made a lot of movies. I have just gone through about 8 discs, all with no audio when I play them!!!

    You need to ask for support in the iMovie forum.

  • I'm trying to retouch an image and I keep getting a message "you must option-click on the image to define a source point"  I ca't seem to get anything to work.  What is option-click?

    I'm trying to retouch an image and I keep getting a message "you must option-click on the image to define a source point"  I ca't seem to get anything to work.  What is option-click?

    leonieDF wrote:
    but always with the  (⌥) sign.
    Not always true. I have the wireless keyboard and the symbol is not on it (just looked at an old Apple wireless keyboard andit to doesn't have the symbol on it).

  • BUG! iphoto stalls when trying to create a book and no event is selected

    however, works fine when trying to create a book and an event or an album is selected... obviously a bug.

    Solution - do not do that
    and report to Apple - iPhoto menu ==> provide iPhoto feedback
    But it is likely that updates for '09 are over since it is a couple of years old and '11 is out
    LN

  • Draw graphics on Image and Save it

    hi!,
    Can anyone help me how to draw graphics(Line, rectangle.ect) on an Image and save it. I need to do the following steps.
    1. Get the Image from the local file system
    2. Based on the parameters i receive for graphics(Ex: rectangle).
    -I have to draw a rectangle on the Image.
    3. Save the Image again to the file system
    I would appreciate if any one has any ideas or sample code I can start with.
    Thanks!!!

    Here's an example using the javax.imageio package.
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Rectangle;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    public class DrawOnImage {
        public static void main(String[] args) {
            try {
                BufferedImage buffer = ImageIO.read(new File(args[0]));
                Graphics2D g2d = buffer.createGraphics();
                Rectangle rect = new Rectangle(10, 10, 100, 100);
                g2d.setPaint(Color.RED);
                g2d.draw(rect);
                ImageIO.write(buffer, "JPG", new File(args[1]));
            } catch (IOException e) {
                e.printStackTrace();
    }

  • How to scan with capture image and save 10.6.8

    how to scan with capture image and save 10.6.8 ?

    Instructions for using Image Capture for this available via the 2nd section.
    http://support.apple.com/kb/HT2502

  • Labview IMAQ VI for capturing images and saving with incremental file names

    Hello,
    I am using LabView 7.1(IMAQ) to capture images with NI's PCI 1426 card, and a JAI CV-M2 camera. Now, with the example VI's like LL Grab, or LL Sequence, or Snap and Save to File.vi, I can capture the images. But what I actually want is to capture images continuously and keep saving them with a sequentially incrementing file name.
    I have tried to modify the Snap and Save to File.vi  by adding a 'for loop', so as to run this for required number of images. This works okay, but I can't really change the file name after every image. However, I'm not confident with this method either. I think it would be better to use the buffer itself, as is given in LL Grab.vi and somehow save images from the buffer. I think this would be faster ?
    In any case, any ideas as to how I should go about implementing auto-incrementing of the file name ?
    Any help will do. 
    Thanks.
    - Prashant

    Hi,
    Thanks a lot for replying. 
    I tried using this in the VI i was working with, but using the "build path" vi doesnt seem to work. If I use just the base path from user's input, it works, but then again it keeps overwriting the images into one file rather than giving each file a new name. I'm attaching the vi. 
    Please take a look and tell me where i'm going wrong.
    Thanks again.
    Attachments:
    LL Sequence_mod.vi ‏62 KB

  • How to change and save a new file in Edge web Lumira server for Team ?

    Hi Lumira folks,
    I've installed SAP Lumira 1.0, Edge edition and View a sample 'Dairy Wholesaler-Sample"
    I'd like to change it and save as new file, but "Save" button is disabled and when I put my mouse over the button,
    it says "Save Option is disabled in this version".
    Is there any idae how to change and save as a new file in Lumira Edge ?
    Many Thanks.
    JH

    I've just found the reason as below.
    http://scn.sap.com/community/lumira/blog/2015/03/20/lumira-server-for-teams-edge-edition-version-compatibility
    The current version of Lumira
    server for teams is 1.0. This version uses Lumira 1.22 as its 'engine' as this
    was the version of Lumira Desktop that was shipped at the same time.
    Hence with the current Lumira
    version compatibility; namely that a newer version of the product can open an
    older document, but an older version cannot open a newer document, care must be
    taken when deploying Lumira server for teams.
    Lumira server for teams is only
    compatible with Lumira desktop 1.22. If you intend to deploy Lumira server for
    teams, ensure your desktop users do not move to a later version of the desktop.
    Content created in a later version of Lumira desktop can be uploaded and shared
    via Lumira server for teams, but it cannot be viewed or edited online in the
    browser.
    Ensure desktop users disable the
    auto update capabilities in the desktop preferences, and set the update to
    none.

  • How can I edit and save a raw file in jpeq and open it in windows live photo gallery

    how can I edit and save a raw file in ps elements 10 and open it in windows live photo gallery?

    Change to 8 bit mode before clicking the Open Image button, then jpeg will become available as a choice.
    Click to view image

  • I have a problem during the collect data and save it in file with the HP8753C

    Hello,
    I'm using the "HP8753 collect and display data.vi" with the functionnality "save" in file (.txt or xls).
    When I'm using it to collect and save data one time to time, I have no problem. But when I would like to use it to collect and save several data with a structure "For", the HP8753 status will become blocked and the collect and save data in file is disable.
    The only function "collect data" with a structure "for" is Ok but will become not OK with the option "save" in file. Why, please ?

    Hello,
    Thank you for contacting National Instruments.
    It sounds like your instrument is "hanging" or "freezing" when you try to read and save data from it in LabVIEW.
    I took a look at the context help for that particular VI. It appears that if you attempt to read data from the HP8753 while it is also taking measurements, it can cause the instrument to hang. This may be the problem you are experiencing.
    Look over your program and ensure that the instrument is not trying to take new measurements as you read data from it in LabVIEW. Sequence structures may be useful in this regard. If you are still experiencing problems, however, let me know.
    Matthew C
    Applications Engineer
    National Instruments

Maybe you are looking for

  • Audio out from HDMI to TV cuts out

    I'm looking for help to troubleshoot the following problem: I have a brand new iMac, 27", i7 (my first Mac ever). Using the Moshi Mini DisplayPort HDMI adapter, I output video and audio to my LG 55LH90 1080p LED TV. Everything is fine except that app

  • Class loading problem with websphere 6.1

    Hello We have a jsf application that works fine with tomcat as well as jboss. Now we need to deploy on websphere 6.1 and encounter some problem. We followed the specifications of this link [regarding jsf and Weblogic|http://www-01.ibm.com/support/doc

  • FND_REQUEST_SET.FNDRSSUB

    Hi, I want to submit FND_REQUEST_SET.FNDRSSUB as a anoymous block It has two IN parameters appl_id and set_id How can i get these parameters?? basic reason why am submitting this from backend is...i have a CP which has a executable FNDRSSUB and the C

  • My iPhone 6 is only getting 3, sometimes 2 bars on my wifi....and its slow.....my 4s got 5 bars all the time on my home wifi.....any suggestions?

    My iPhone 6 is only getting 3, sometimes 2 bars on my wifi....and its slow.....my 4s got 5 bars all the time on my home wifi.....any suggestions?

  • Connect by help

    Please can someone help see below example My aim is to find the top parent node but pass in a lower or joint level item. So my example here has contains the tree structure 100 'A' 200 'B' 300 'B' And i require if i put in 300 'B' or 200 'B' it tells