Loading image of all type. help me

Iam new for java.
I want to load image file having any extension. Can any body help me in any way, i will be thankful to them.

Java only supports .jpg .gif and .png. Any other type won't work. Use
Toolkit.getDefaultToolkit().createImage(filename/url);
Toolkit is located in java.awt. You could also check out the Java Imaging API to see if there are more formats in that one. You'll have to download it from the java website.

Similar Messages

  • Loading images from Jar - Please help!

    Tried with / in front of the path or without and using both
    getImageResource and getSystemImageResource methods and no images
    are showing.
    My jar has manifest file of:
    Main-Class: com.package.MainFrame
    Class-Path: j2ee.jar
    - blank line -
    Thanks
    Abraham Khalil
       // The subtlety in getResource() is that it uses the
       // Class loader of the class used to get the rousource.
       // This means that if you want to load a resource from
       // your JAR file, then you better use a class in the
       // JAR file.
       public static Image getImageResource( String name ) throws java.io.IOException {
          return getImageResource( AWTUtilities.class, name );
       public static Image getImageResource(Class base, String name ) throws java.io.IOException {
          Image result = null;
          URL imageURL = base.getResource( name );
          if (imageURL == null) {
             imageURL = base.getResource("/" + name );
          System.out.println("imageURL: " + imageURL + " AWTUtilities.class.getResource(" + name + ");");     
          if ( imageURL != null ) {
             Toolkit tk = Toolkit.getDefaultToolkit();
             result = tk.createImage( (ImageProducer) imageURL.getContent() );
          return result;
       public static Image getSystemImageResource( String name ) throws java.io.IOException {
          Image result = null;
          URL imageURL = ClassLoader.getSystemResource( name );
          if (imageURL == null) {
             imageURL = ClassLoader.getSystemResource("/" + name );
          System.out.println("imageURL: " + imageURL + " = ClassLoader.getSystemResource(" + name + ");");
          if ( imageURL != null ) {
             Toolkit tk = Toolkit.getDefaultToolkit();
             result = tk.createImage( (ImageProducer) imageURL.getContent() );
          return result;

    Hello,
    you must put your images files under your package :
    see full doc at this tutorial.
    Hope this helps,
    Neo

  • Mail: Load Images for trusted senders

    Hi,
    Within mail / Preferences, I've disabled loading images for all received email. However, I'd like to be able to automatically load images for any sender in my address book or use some other whitelist mechanism to trust certain senders so that I don't have to "load images" so often. Any ideas?
    Thanks,
    Robert

    This may be a question for the Apple Script forum, as mail rules has the capacity to run an apple script based upon set criteria.
    Something like:
    on new received message > checked senders > if sender is in address book > run apple script to load images.
    If I was an apple script type I might be able to help, sadly though I am not.
    Try posting here: http://discussions.apple.com/forum.jspa?forumID=724
    I hope you find a successful solution.
    Cheers!
    Michael

  • Firefox does not load images over HTTPS

    When viewing secure sites (HTTPS) images are not displayed on FF 3.6.6
    For example: I can not see images on Gmail, Google Images or StumbleUpon
    I have checked the images settings and it automatically loads images from all sites, there are no domains blocked
    There is no add-on to block images
    Javascript is enabled
    I've tested almost all network configuration but the problem persists
    If I inspect the image with Firebug 1.5.4 the image is available as preview
    The same page is correctly displayed on IE8
    I've tested in safe-mode but the error remains
    Again... I suspect it has something to do on how FF 3.6.6 handles HTTPS
    Even if you do not have an answer, post if you experience the same problem.
    Thanks for your help!
    == This happened ==
    Every time Firefox opened
    == After las upgrade

    Try "Reset all user preferences to Firefox defaults" on the [[Safe mode]] start window - See http://kb.mozillazine.org/Resetting_preferences
    See also http://kb.mozillazine.org/Preferences_not_saved
    Create a new profile as a test to check if your current profile is causing the problems
    See [[Basic Troubleshooting|#Make_a_new_profile|Basic Troubleshooting: Make a new profile]]
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins"
    If that new profile works then you can transfer some files from the old profile to that new profile (be careful not to copy corrupted files)
    See http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • Need Help for Embed Tag to playing all type of video files in any browser

    Hai,
    I am using the following Embed Tag for playing video files in Browsers.
    <OBJECT
    ID="mediaPlayer"
    CLASSID= "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    CODEBASE= "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
    TYPE="application/x-oleobject"
    STANDBY="Loading media player components..."
    HEIGHT="200" WIDTH="250">
    <PARAM NAME="showcontrols" VALUE="true">
    <PARAM NAME="autostart" VALUE="false">
    <PARAM NAME="loop" VALUE="false">
    <PARAM NAME="filename" VALUE="photo/video/<%=category%>/<%=image.elementAt(i*4+1)%>">
    <EMBED TYPE="video/x-msvideo"
    STANDBY="Loading media player components�"
    CONTROLLER="true"
    CONTROLS="ImageWindow,ControlPanel"
    SHOWCONTROLS="true"
    AUTOSTART="false"
    HEIGHT="200" WIDTH="250"
    SRC="photo/video/<%=category%>/<%=image.elementAt(i*4+1)%>" >
    </OBJECT>
    But this Embed Tag does not playing such type of video files(ex: *.flv, *.mov, *.avi etc.,)
    i need to play all types of video files using the Embed Tag.
    Can anyone please help me for this.
    Edited by: devtamil on Oct 3, 2007 12:27 PM

    Hi,
    Im having a similar problem and i was wondering if you were able to get a solution??
    Thanks for your help.

  • I was changing my desktop screen saver in system preferences screen protection.  Now it says it is "Loading Images" and won't stop.  The Colourful wheel goes around for ever and It does not stop. Can anyone help me?

    I was changing my desktop screen saver in system preferences>screen protection.  Now it says it is "Loading Images" and won't stop.  The Colourful wheel goes around for ever and It does not stop. Can anyone help me?

    Welcome to the Apple Support Communities
    I have seen a lot of cases like your issue, and it's easy to solve.
    First, open Disk Utility, select Macintosh HD in the sidebar and repair permissions. Sometimes, a permission can be damaged and it makes that an application doesn't work properly.
    If that doesn't work, open Finder, select Go menu > Go to Folder, type ~/Library/Prefereces, delete "com.apple.desktop.plist" and "com.apple.systempreferences.plist" and restart

  • Need help Loading images with selection on a form field?

    So I'm kind of a newb.. I can do basic forms but I need to set up a form field drop down box that will give me the ability to load images correlating to the users choice. I'm at a total loss for where to start, so ANY help would be appreciated. If you know of any good books or tutorials on the subject please share.
    Thanks in advance
    Sincerely,
    Stumped4now 

    P.S. I think I'm getting a better understanding of OCGs after lots of research today. However I still seem to be missing something
    var docOCGs = this.getOCGs();
    for (var x=0; x < docOCGs.length; x++)
      if(docOCGs[x].name == "Layer1")
      docOCGs[x].state = !docOCGs[x].state;

  • [noob needs help] Loading image from a URL

    Hey everyone. I'm new here. And I'm new at J2ME as well.
    I have a simple school project and I have doubts about it. I've searched everywhere on the net yet I could not find the solution. Anyways, I do understand the concept of loading images by putting the files in the "res" folder and use:
    try
    img = Image.createImage("/burgerimgsmall.jpg");
    catch (Exception e)
    e.printStackTrace();
    But my project requires me to load an image from a URL. How do I go about doing that? If it helps, here's the URL:
    http://img.photobucket.com/albums/v703/punkgila/burgerimgsmall.jpg
    Thanks guys!

    Don't worry, downloading image from http is also simple. Look into Photoalbum demo in wtk2.5

  • Getting all types of files with the help of get_file_name function

    hi all,
    i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
    i have used get_file_name function to the file name of all type of files
    but i am able to get only the folders when i tried like below
    :FILE_NAME := GET_FILE_NAME(NULL,NULL,NULL,'Choose a Directory',OPEN_FILE,FALSE);my requirement to get all types of files on the window(user will selects whichever way he wants)
    Can i acheive it through get_file_name or i have to go for any alternative to get the file list, so that user can select by browsing the folders.
    Please help.
    Thanks..

    hi,
    in my code the select file was set to false(so showing only the directories) now i have set it to 'true'. its showing the files now.
    with the help of my above shown code i can get the full path of the file.
    is there any way to get only the file name?(other than the last occurance of '/' logic or that is only the way?)
    Please help.
    Thanks..

  • Facebook is not loading properly and all my text and images are lined up along the right side of the page. How can this get fixed to the way it use to be?

    Facebook is not loading properly and all my text and images are lined up along the right side of the page. How can this get fixed to the way it use to look?
    Everyone who logs into Facebook on my Firefox has this problem however if we use Internet Explorer - facebook looks normal.

    If you have increased the minimum font size then try the default setting "none" as a high value can cause issues like you described.
    * Tools > Options > Content : Fonts & Colors > Advanced > Minimum Font Size (none)
    *Tools > Options > Content : Fonts & Colors > Advanced > [X] "Allow pages to choose their own fonts, instead of my selections above"

  • Load images in the correct order, needs help..

    I have tried loading in some images in the order of the xml files.. that contain them ..
    they did load in one by one but .. in  random order .. so mabe i am doing too much or too liitle can some one give it asecond look for me ..
    //-- load Xml
    urlLoader.load(new URLRequest("loader_alpabet/loader_alpabet.xml"));
    urlLoader.addEventListener(Event.COMPLETE,xmlReady);
    this.addEventListener(Event.ENTER_FRAME,entFrm);
    // process the Xml and create array of objs
    function xmlReady(evt:Event):void {
         xml=new XML(evt.target.data);
         var xmlListUrls:XMLList=new XMLList(xml.image.url.text());
         var xmlListNames:XMLList=new XMLList(xml.image.name.text());
         var xmlListDescs:XMLList=new XMLList(xml.image.description.text());
         for (var g:Number = 0; g < xmlListNames.length(); g++) {
              imagePack.push({name:xmlListNames[g],url:xmlListUrls[g],desc:xmlListDescs[g]});
              if (xmlListUrls.length()==imagePack.length) {
                   loaderMachine();
    //this is where i position the images
    function entFrm(evt:Event):void {
         if (imageIcons.length>0) {
              for (var g:Number = 0; g < imageIcons.length; g++) {
                   imageIcons[g].x=(centerX+Math.cos(angle+g)*radiusX)-imageIcons[g].width/2;
                   imageIcons[g].y=(centerY+Math.sin(angle+g)*radiusY)-imageIcons[g].height/2;
                   imageIcons[g].scaleX=imageIcons[g].scaleY= ((imageIcons[g].y/150) - 0.5);
                   stage.addChildAt(imageIcons[g], imageIcons[g].scaleX);
                   angle+=speed;
    //-- loader function
    function loaderMachine():void {
         trace(imagePack.length);
         loader = new Loader();
         loader.load(new URLRequest(imagePack[count].url));
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageReady);
    // put image on stage
    function imageReady(evt:Event):void {
         var image:Bitmap = (Bitmap)(evt.target.content);
         addChild(image);
         imageIcons.push(image);
         count++;
         if (count<imagePack.length) {
              loaderMachine();

    ah, I missed the 2nd version of the code
    You have to take the loaderMachine(); call out of the loop, call it after the loop.
    function xmlReady(evt:Event):void {
         xml=new XML(evt.currentTarget.data);
         var xmlListUrls:XMLList=new XMLList(xml.image.url.text());
         var xmlListNames:XMLList=new XMLList(xml.image.name.text());
         var xmlListDescs:XMLList=new XMLList(xml.image.description.text());
         for (var g:Number = 0; g < xmlListNames.length(); g++) {
              imagePack.push({name:xmlListNames[g],url:xmlListUrls[g],desc:xmlListDescs[g]});
          // start loading images
         loaderMachine();
    You're overwriting you loader instance each time you load an image, that's not good if you want it to stick around (display each loaded image).
    So in the method, create a local Loader instance and add it to the Array stack.
    Don't start the enterFrame event handler until all images are loaded.
    You can do so in the imageReady() event handler (check if counter equals array length).
    Don't add event listeners in the enterFrame event handler, you're adding them over and over again.
    So remove these from entFrm()
    imageIcons[g].addEventListener(MouseEvent.MOUSE_OVER,btn_mouse);
    imageIcons[g].addEventListener(MouseEvent.MOUSE_OUT,btn_mouse);
    Don't use Event.target (unless you know what you're doing), use currentTarget instead.
    function imageReady(evt:Event):void {
         var loader:Loader = (event.currentTarget as LoaderInfo).loader;
         loader.addEventListener(MouseEvent.MOUSE_OVER, btn_mouse);
         loader.addEventListener(MouseEvent.MOUSE_OUT, btn_mouse);
         addChild((loader);
         count++;
         if (count<imagePack.length) {
              loaderMachine();
        }else{
              addEventListener(Event.ENTERFRAME, entFrm);
    Don't use Array.length in a loop condition, as this will check the lenght with each iteration, slowing down the loop.
    Set it to a local variable once and use that as the loop condition.
    var len:uint = imageIcons.length;
    for(var i:uint=0; i<len; i++) {}
    Last but not least, you're probably better off using a tween engine rather than an enterFrame event to move things around.
    Look into TweenLite.
    http://blog.greensock.com/tweenlite/
    It now looks like the enterFrame event continues untill you roll over one of the buttons? If so, that can't be good..
    function loaderMachine():void {
         var loader:Loader = new Loader();
         loader.load(new URLRequest(imagePack[count].url));
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageReady);
         imageIcons.push(loader);

  • The iphoto on my macbook isn't responding. I click on the app but once it opens it starts to load and thats all it does. The wheel continues to spins. any one have any suggestion on how to fix the problem? i'd appreciate the help =]

    The iphoto on my macbook isn't responding. I click on the app but once it opens it starts to load and thats all it does. The wheel continues to spins. any one have any suggestion on how to fix the problem? i'd appreciate the help =]

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • When i open my itunes store, it says secure link to itunes failed and it doesnt load up, what seems to be the problem here? appreciate all the help i can get, thanks! :)

    When i open my itunes store, it says secure link to itunes failed and it doesnt load up, what seems to be the problem here? appreciate all the help i can get, thanks!

    Yes, provided all the media is inside the iTunes Media folder, which is in turn inside the main iTunes folder (which is the standard arrangement) you should be able to move the iTunes folder from <User's Music> to any other path and shift-start-Tunes (option-start-iTunes on a Mac) to reconnect to it.
    If the media folder has split out to another drive in the past, or media is stored outside of the iTunes Media folder, then things get a bit more complicated. I can go into details should it be necessary.
    tt2

  • HELP?!? - Website BeachBalls/Hangs Safari in OSX and iOS, loads fine on all other browsers.

    Site beachballs Safari in OSX and iOS, loads fine on all other browsers.
    The page loads in safari if javascript is disabled, so it would seem to be something javascript related that is causing the issue.
    Because it beachballs safari i can't even debug the issue in safari.
    This site was working in Safari before, I beleive this issue started with the latest Safari update, but don't hold me to that.
    I need help figuring out what the issue is so I can fix it for Safari users.
    Since it bricks safari i can't even get far enough to determine what the issue is or set debug points or gleen any helpful information from Safari about why this may be happening.
    I might be forced to hack out sections until i can eliminate/pinpoint the code, but being a magento site that is a very complex and daunting proposition.
    Please help!!! Please, please, pretty please. :-)
    Pointers? Tips? Ideas on how to track down the issue?
    site is: http://bumblebeetoys.com/
    (no flash or similar content in this page, this is a standard magento website.)
    Many many many thanks to anyone who can help resolve this issue or has any helpful pointers about tracking it down.
    Thanks,
    Josh

    I ran your site with Firefox error console and got the attached, perhaps Safari can't handle these errors.  Activity monitor does show Safari in a hard cpu loop while trying to access the site.  'Sample Process' seems to point at a Java Script as the culprit.

  • So I've downloaded a tv series from iTunes onto my macbook pro, for some reason the episodes on my iTunes won't play at all. no sound and no images. any suggestions and help?

    so I've downloaded a tv series from iTunes onto my macbook pro, for some reason the episodes on my iTunes won't play at all. no sound and no images. any suggestions and help?

    Hi,
    As you have match, I suggest that you create a new library by holding ctrl whist launching iTunes. Select create new library. Sign into iTunes Store and activate match. You will now have access to your music and will be able to stream your music.
    Options : get a new external drive formatted for mac and either download music from match or copy music from old drive to new one. Alternatively you could reformat old drive and download music from match - I would not be comfortable using this option as it means erasing drive before being able to use with mac.
    Jim

Maybe you are looking for