How to load an image from local filesystem, and paint it to a frame

Please offer an AWT solution

Image getImage
    String path
    Image image = Toolkit.createImage(path);
    loadImage(image);
    return image;
void loadImage
    MediaTracker mt = new MediaTracker(image_observer);
    mt.addImage(image, 0);
    try
        mt.waitForID(0);
    catch interrupted exception
class extends Panel
    Image image
    public void paint(
        g.drawImage(image,
    public void update(
        paint(g);
    public Dimension getPreferedSize
        return size of image

Similar Messages

  • How to load an image from local disk?

    Hi!
    I have spent hours on the net searching for an example, that
    could
    show me how could I make a flex script that user could browse
    (like fileReference.browse() ) for a
    file (picture) and then show this picture in the browser (so
    the source of some existing picture would change).
    I found only multiple solutions on how to upload a picture,
    but
    that is not the thing I wanna do. I want a user to load a
    picture from
    his disk and simply to be seen in a browser (on a page).
    I tried programming it alone, but the FileReference class has
    no attribute path or similar, that I could use for source of my
    image.
    Please help, I need to do this urgently.
    Thank you very very much
    Gus

    OK, I tried without FileReference, simply by changing String
    variable of the source path when calling image.load(path), but it
    works ONLY FOR REMOTE pictures (online), I also tried with
    [Bindable]
    [Embed(source="C:/somePicture.jpg")]
    public var _img0:Class;
    , but it appears that you CANNOT CHANGE THE PATH DOURING
    EXECUTION (dinamically)
    So please, someone?
    Is it even possible to do that?
    I could try uploading picture and then downloading, but why
    would I need a server side if I don't need it...
    Help

  • How to Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER in VC++ ?

    Hi,
    I have :  -  IMAQ1394 2.0.1
                  -  NI Vision 7.1
    In VB, I can Snap/Grab Image from 1394 camera and display the Image in CWIMAQVIEWER :
        Dim Image0 As New CWIMAQImage
        imaq1394SnapCW(sid0,Image0)
        CWIMAQViewer1.Attach Image0
    Now,How can I do this in VC++6.0?
        I tried:
                  C_CWIMAQImage m_imgViewer1;
                  m_imgViewer1 = m_CWIMAQVision1.CreateCWIMAQImage();
                  m_CWIMAQViewer1.Attach(m_imgViewer1);
                  imaq1394SnapCW(Sid,m_imgViewer1);  <--there is no "imaq1394SnapCW "function in VC++,why?
        Please help me!
        Thank you!

    For people looking back at these old posts regarding
    CWIMAQViewer - it was not made to be used in the C environments and is made
    for VB.
    Refer to the following locations for displaying images in C
    environments:
    Start»All Programs»National Instruments»Vision»Documentation
    Start»All
    Programs»National Instruments»Vision»Text Based Examples
    Make
    sure that you look at the examples and documentation that is in
    reference to the C environments not the VB environments
    Vince M
    Applications Engineer

  • Loading an Image from the database and display it on browser

    I do not know if this is even possible.
    At the moment, to load an image inside an Html page you need to use the <img src=""> tag. and in the src you put the path of the image. Now I would like to save an image inside the database.
    An option to still display the image on the browser would be that my service object, would load the object from the database (saved as blob) then save it somewhere on the Server, and the still use the <img> tag to load the image from that location.
    However I was wondering wheather there is another way to do it without saving this image on the server. that is loading the bytes from the database (or a location on the server) and provided these bytes to the jsp page to display the image.
    Is this possible? or?
    regards,
    sim085

    hmm ... ok .. that sounds good .. but that means that
    a servlet must exsist at all time to display the
    required image.Servlets are usually instantiated by the servlet container upon an incoming request.

  • How do you copy images from the internet and paste them on Microsoft Word

    I'm trying to copy images from the internet and trying to paste them on to Microsoft Word and Powerpoint for an assignment but it's not working. I tried to use copy and paste and then paste special but nothing is working. Saving the image onto documents and trying to open them on Microsoft Word still doesn't work.
    PLEASE HELP!!!
    Thank you

    Hi Lily, and welcome to Apple Discussions.
    A screenshot can capture almost anything you're viewing. Hold the command and shift keys down, then press the 4 key and release all keys. Hold down the mouse button and drag the cursor to the size/area of the image you want to capture. Release the mouse button and you've captured the image. Remember that it is the individual's responsibility to respect copyright laws.

  • How to load a image from database to image item in oracle 10 g form

    I have stored some images in the Database Table with BLOB datatype. Now I need to load that image in the non database image item. Please advise. Thanks.

    You need to have a print server installed to generate the pdf. Either use BI Publisher and it's desktop development tool or use FOP/Cocoon.. Adding an image with them is a little more involved..
    Thank you,
    Tony Miller
    Webster, TX
    While it is true that technology waits for no man; stupidity will always stop to take on new passengers.

  • Resize image from local drive and upload to server

    Hi there
    I want to allow the user to chose an image from his local
    hard drive.
    The image should then be loaded into the Flex 2 application.
    There I wanna show him infos about the image e.g. height and
    width.
    He should then be able to scale/resize the image and upload
    it to the server.
    I have no idea how to do that :-)
    Any thoughts on that?
    Thanks in advance
    Bernd

    Well in short, you need a second language to support that,
    e.g. PHP/ASP/CF.
    First you'll have to build a GUi in which you can upload the
    jpg, putting it to the server using php/asp/cf, then you'll need to
    make a call to that image, (importing it into your flex), then
    you'll have to set the parameters for the resizing, then you'll
    have to call a php/asp/cf script which does te resizing

  • How to load a config from one appliance and publish it to both

    Hi,
    We're using  AsyncOS7.5 on two WebAppliances S360 with a
    Configuration Master 7.5 (M160).
    I used one of both appliances to implement URL Filtering and now I'd like to transfer
    this coniguration to the the master in order to publish it to both appliances.
    As I could see it doesn't appear to be possible to load the config from one
    specific appliance.
    How can I do that the best?
    Any hints?
    Thanks
    Jannis

    Jannis,
    You can import the config file from the WSA which URL filtering has been configured to the M160 in Configuration Master 7.5. This will wipe out the current configuration master 7.5 stored in the M160, and you can then publish the same config to the other WSA.
    Check the online help for section "Initializing and Importing Configuration Masters"
    Hope this helps.
    - donny

  • How to Drag a image from a folder and drop it into Photoshop, InDesign using keyboard?

    Hi!
    Others may think silly about this question but the reality is I have to drag and drop several images into InDesign from a folder each one by one. Is it possible to drag and drop images from desktop (folder) to Adobe InDesign, Photoshop, etc?
    Thanks!
    Hope a positive reply.

    Thanks Peter/Jongware
    I searched Google and found the link below but became unable to use 'drag and drop'
    http://www.knowledgesutra.com/forums/Keyboard-Mouse-t49017.html
    I'm using Windows 7 Ultimate.
    Thanks.

  • To load the image from appl. server to FORM

    Hi all,
    i have to fetch the image from Application server and Print in a form. i don't know how to load the image from appl. server to FORM.Through SE78 i guess we can load the image only from presentation server,,,,can anyone help on this????

    Hi Bhuvaneshwari ,
    Through <b>SE78</b> you can fetch the image from application server.
    Goto><b>Graphics</b>><b>BMAP(Bit map images)</b>>In <b>Name</b> parameter click <b>F4</b> for input help.>click on <b>execute</b> button.
    These images are stored on document server.
    There you can find images of application server.
    Those images you can import.
    Reward if helpful.
    Regards,
    Sandhya.

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

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

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

  • How could I to load my applet from local

    hI all,
    How can i to load my applet from local file system.
    Thanks

    Put it anywhere you want. Put the associated HTML file in the same directory as your .class file and double click on the HTML file. Your browser should open up and display your Applet.

  • Loading an image from CameraRoll - how long should it take ?

    Hi All
    I'm loading an image from the CameraRoll using this method http://www.flashandmath.com/mobile/cameraroll/
    Now on my iPad2 the image loads pretty instantaneously
    However on my iPhone4 it takes approx 8 seconds for the image to load.
    ( The time is taken after calling loader.loadFilePromise waiting for Event.COMPLETE ... i.e. the image to load )
    function onImgSelect(event:MediaEvent):void {
    var promise:MediaPromise = event.data as MediaPromise;
    removeBrowseListeners();
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
    loader.contentLoaderInfo.addEventListener(ErrorEvent.ERROR, onError);
    loader.loadFilePromise(promise);
    The code base is the same. There are (at least) 2 differences :-
    1) The hardware (iPad vs phone)
    2) The number of images on the camera roll (approx 60 on iPad vs almost 900 on the phone)
    Has anyone else noticed such a difference in speed between devices / number of files ?
    Is there a better/quicker way to load an image from CameraRoll ?
    Is 8 seconds normal/acceptable (I show a busy indicator)
    Any help / suggestions/ observations most appreciated !

    If you opted for the Secure Erase and the account has a lot of data in it, then it could take days to complete.

  • How to load mutiple image

    I'm trying to create a photo manager but I can't find a way to load multiple images onto my frame. I have a thumbnail class that makes thumbnails for an image (which is a modified version of the class ImageHolder from FilthyRichClient)
    public class Thumbnails {
         private List<BufferedImage> scaledImages = new ArrayList<BufferedImage>();
    private static final int AVG_SIZE = 160;
    * Given any image, this constructor creates and stores down-scaled
    * versions of this image down to some MIN_SIZE
    public Thumbnails(File imageFile) throws IOException{
              // TODO Auto-generated constructor stub
         BufferedImage originalImage = ImageIO.read(imageFile);
    int imageW = originalImage.getWidth();
    int imageH = originalImage.getHeight();
    boolean firstScale = true;
    scaledImages.add(originalImage);
    while (imageW >= AVG_SIZE && imageH >= AVG_SIZE) {
         if(firstScale && (imageW > 320 || imageH > 320)) {
              float factor = (float) imageW / imageH;
              if(factor > 0) {
              imageW = 320;
              imageH = (int) (factor * imageW);
              else {
                   imageH = 320;
                   imageW = (int) (factor * imageH);
         else {
              imageW >>= 1;
         imageH >>= 1;
    BufferedImage scaledImage = new BufferedImage(imageW, imageH,
    originalImage.getType());
    Graphics2D g2d = scaledImage.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2d.drawImage(originalImage, 0, 0, imageW, imageH, null);
    g2d.dispose();
    scaledImages.add(scaledImage);
    * This method returns an image with the specified width. It finds
    * the pre-scaled size with the closest/larger width and scales
    * down from it, to provide a fast and high-quality scaled version
    * at the requested size.
    BufferedImage getImage(int width) {
    for (BufferedImage scaledImage : scaledImages) {
    int scaledW = scaledImage.getWidth();
    // This is the one to scale from if:
    // - the requested size is larger than this size
    // - the requested size is between this size and
    // the next size down
    // - this is the smallest (last) size
    if (scaledW < width || ((scaledW >> 1) < width) ||
    (scaledW >> 1) < (AVG_SIZE >> 1)) {
    if (scaledW != width) {
    // Create new version scaled to this width
    // Set the width at this width, scale the
    // height proportional to the image width
    float scaleFactor = (float)width / scaledW;
    int scaledH = (int)(scaledImage.getHeight() *
    scaleFactor + .5f);
    BufferedImage image = new BufferedImage(width,
    scaledH, scaledImage.getType());
    Graphics2D g2d = image.createGraphics();
    g2d.setRenderingHint(
    RenderingHints.KEY_INTERPOLATION,
    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    g2d.drawImage(scaledImage, 0, 0,
    width, scaledH, null);
    g2d.dispose();
    scaledImage = image;
    return scaledImage;
    // shouldn't get here
    return null;
    A loop will loop through a collection of files and pass them to the constructor of Thumbnails to create thumbnails and then set them as icon for JLabels that will be added to a JPanel, but it throws a java.lang.OutOfMemoryError at this line:
    BufferedImage originalImage = ImageIO.read(imageFile);
    even when there're only about 8 image files in the collection (total size 2,51MB).
    I've seen other people's software that could load hundreds of photos in a matter of seconds! How do I suppose to do that? How to load mutiple images efficiently? Please help!! Thanks a lot!

    another_beginner wrote:
    Thanks everybody! I appreciate your help! I don't understand why but when I use a separate thread to do the job, that problem disappear. You were likely doing your image loading and thumnail creation on the Event Dispatching Thread. Among other things, this is the same thread that updates and paints your panels, frames, buttons, ect.. When a programer does something computationaly expensive on the event dispatching thread then the GUI becomes unresponsive until the computation is done.
    Ideally what you want to do is load images and create thumnails on a seperate thread and update your GUI on the event dispatching thread. I supect that while you are finally doing the first item, you might now be violating the second item.
    Whatever, the program seems to be pretty slow on start up 'cause it have to reload images everytime. I'm using Picasa and it can display those thumbnails almost instantly. I know that program is made by professionals. But I still want to know how.I took a look at this Picasa you mentioned. It's the photo manager from google right? You're right in that the thumnails display instantly when starting up. This is because Picasa is actually saving the thumnails, instead of creating them everytime the program starts up. It only creates the thumnails once (when you import a picture) and saves the thumnail data to " +*currentUser*+ /AppData/Local/Google/Picasa2/db3/" (at least on my computer --> Vista).
    Also, if your looking for speed then for some inexplicable reason java.awt.Toolkit.getDefaultToolkit().createImage(...); is faster (sometimes much faster) than ImageIO.read(...). But there comes a price in dealing with Toolkit images. A toolkit image isn't ready for anything until it has been properly 'loaded' using one of several methods. Also, when you're done and ready for the image to be garbage collected then you need to call Image.flush() or you will eventually find yourself with an out of memory error (BufferedImages don't have this problem). Lastly, Toolkit.createImage(...) can only read image files that the older versions of java supported (jpg, png, gif, bmp) .
    And, another question (or maybe I should post it in a different thread?), I can't display all thumbnails using a JPanel because it has a constant height unless I explicitly set it with setPreferredSize. Even when put in a JScrollPane, the height doesn't change so the scrollbar doesn't appear. Anyone know how to auto grow or shrink a JPanel vertically? Or I have to calculate the preferred height by myself?Are you drawing the thumnails directly on the JPanel? If so then you will indeed need to dynamically set the preferred size of the component.
    If not, then presumebly your wrapping the thumnails in something like a JLabel or JButton and adding that to the panel. If so, what is the layout manager you're using for the panel?

  • How to load an image into blob in a custom form

    Hi all!
    is there some docs or how to, load am image into a database blob in a custom apps form.
    The general idea is that the user has to browse the local machine find the image, and load the image in a database blob and also in the custom form and then finally saving the image as blob.
    Thanks in advance
    Soni

    If this helps:
    Re: Custom form: Take a file name input from user.
    Thanks
    Nagamohan

Maybe you are looking for

  • Error while deploying the SAR file to EM Console.... MDS-01330: Failed to l

    Hi Team, We configured the HUDSON Tool with BPEL Projects. When I am trying to deploy the BPEL Projects to the SOA SERVER. I am getting an error associated with MDS. We never used MDS for storing teh metaData But still we are getting an error. 10:35:

  • How to avoid the duplicate values, I do not want the duplicate............

    i have one database table called "sms1" that table is updated every day or on daily basis it has the following fields in it: SQL> desc sms1; Name Null? Type MOBILE NUMBER RCSTCNATCNATCNATCNAWTHER VARCHAR2(39 CHAR) SNO NUMBER INDATE DATE From this tab

  • PSD Colour Preference & icc profile for Print and Web projects?

    Using the same Photoshop files for Web- and (4c) printed media projects i wonder if these settings are suitable to enable a good range for both - may you please let me know ? i look forward to any feedback, thanks a lot in advance! ---- please visit

  • SAP S&OP on HANA

    Hello, can anyone provide info regarding the languages supported by the application? Regards, Vaia

  • NVGRE Gateway stops forwarding packets

    I've deployed NVGRE Gateway and added a virtual network using NAT and it works fine.. ...about 15 minutes then everything stops. I have ping running to external IP address and it works fine when adding a NAT connection to the virtual network, but sud