Getting the thumbnail of a LARGE jpeg

Here's the situation: I have a Swing Applet that needs to get the thumbnail of largish JPEGs. For example, a typical digital camera captures a 2000x2000 (or so) image these days. Applets don't get allocated that much memory and can't just load the entire thing in to scale it down.
Is there a good solution to this?
Ideally there would be something in ImageIO like "read scaled instance" that does the scaling as it reads in the data. I'm sure such a thing can be done within JAI. But this needs to be within a run-everywhere applet, so JAI is out of the question.
This seems like an oversight of the Java platform. It should be really simple to just say, "give me a scaled-down version of the image on disk". is there a way?
There's always Plan B which is to write my own JPEG renderer. I can do that but if there's some easier way, I would love to do it.

Lol, yeah, that is a bit large for 128x128. I meant to say I was scaling them to 128x128, but the images were 100K to 400K or so. I even had 3MB or more but no matter, it failed.
I would like to agree with you that ImageIcon can handle large images. It seems that it can't handle more than one or two being loaded at one time though, or there is some other issue going on.
Here is a "simple" bit of code that caused OutOfMemoryError problems for me:
File f = new File("some dir");
File[] files = f.listFiles();
// for the sake of brevity, there is a FileFilter attached to only list .jpeg/.jpg files
List l = new ArrayList(files.length);
for (int cntr = 0; cntr < files.length; cntr++){
  l.add(new ImageIcon(files[cntr].toUrl());
}Run this, and you'll either see the same thing, or there is some odd issue on my machine. I saw this on two machines, but strangely, on another machine, there were no errors. JDKs were all 1.4.2_08 - _10, but I'd like to hope that the minor updates did not break this. It's possible I guess.

Similar Messages

  • Need some help trying to generate thumbnail images from large Jpegs

    Hello,
    I have some ActionScript 3.0 code, created with Flex that
    will load a large JPEG image (say 3000x2000 pixels) that I'm trying
    to create a 100 pixel thumbnail. I have the code working where I
    generate the thumbnail, but it's not maintaining the aspect ratio
    of the original image. It's making it square, filling in white for
    the part that doesn't fit.
    I've tried just setting the height or width of the new
    image, but that doesnt render well, either.
    To see what I'm talking about, I made a screen shot, showing
    the before image, and the rendered as thumbnail image:
    http://www.flickr.com/photos/taude/533544558/.
    Now, there's a few things important to note. I'm saving the
    thumbnail off as a JPEG. As you can see in my sample application,
    the original renders fine with the proper aspect ratio, it's when
    I'm copying the bytes off the bitmapdata object, where I need to
    specify a width and height, that the trouble starts. I've also
    tried using .contentHeight and .contentWidth and some division to
    manually specify a new bitmapdatasize, but these values seem to
    always have NaN.
    private function makeThumbnail():void{
    // create a thumbnail of 100x100 pixels of a large file
    // What I want to create is a a thumbnail with the longest
    size of the aspect
    // ratio to be 100 pixels.
    var img:Image = new Image();
    //Add this event listener because we cant copy the
    BitmapData from an
    /// image until it is loaded.
    img.addEventListener(FlexEvent.UPDATE_COMPLETE,
    imageLoaded);
    img.width=100;
    img.height=100;
    img.scaleContent=true;
    img.visible = true;
    // This is the image we want to make a thumbnail of.
    img.load("file:///C:/T5.jpg");
    img.id = "testImage";
    this.addChildAt(img, 0);
    private function imageLoaded(event:Event):void
    // Grab the bitmap image from the Input Image and
    var bmd:BitmapData =
    getBitmapDataFromUIComponent(UIComponent(event.target));
    //Render the new thumbnail in the UI to see what it looks
    theImage.source = new Bitmap(bmd); //new Bitmap(bmd);
    public static function
    getBitmapDataFromUIComponent(component:UIComponent):BitmapData
    var bmd:BitmapData = new
    BitmapData(component.width,component.height );
    bmd.draw(component);
    return bmd;

    Dev is 10gR2 and Prod is earlier version of Oracle, 10gR1.
    The schema (or table(s)) export file created by Oracle Database Control in Oracle 10gR2 is not importable into 10gR1, by default.
    Workaround.
    Use the Schema (table(s) export wizard of in the Maintenance section
    of the Oracle Database Control in ver 10R2,
    but when you get to the end of the wizard (I recall Step 5),
    show the data pump export source PL/SQL code, cut and past to editor,
    and find the variable where you can set the Oracle database version
    to your prod database version,
    then run the script from the SQL Plus prompt in 10gR2 dev,
    and this creates an Oracle 10gR1 compatible data export file.
    Then go to Prod and run the schema (table(s)) import data wizard,
    and import the export file. You will have to option to move the data
    to another schema or tablespace if required.
    Just to not run into troubles, I use the same schema and tablespace name
    in both dev and prod.
    the variable you must modify in the 10gR2 datapump export script looks like
    h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'ExportTableToProdJob', version => 'COMPATIBLE');
    and you must change manually to
    h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'ExportTableToProdJob', version => '10.1.0.1');
    This creates a 10g1.0.1 or later compatible export data file.
    You must have read/write privileges to the folder were the export data file will be created, and imported from. (Oracle Directory Object)

  • How do I get the thumbnails back on a new tab page?

    I get a AVG Secure Search page instead of the thumbnail page now when I load a new tab. How do I get the thumbnails back? I don't have an gear icon on the page to switch it back. This happen after I did a reset of Firefox so that MapQuest would work again which it now does.
    What is interesting is that I get thumbnails if I open a second Firefox window and then click on a new tap page.
    I've install the searchreset addon with no luck. I've run Microsoft Safety Scanner and no problems have been identified.

    Bookmark and use this;
    Download the '''[https://addons.mozilla.org/en-US/firefox/addon/searchreset/ Mozilla Search Reset]''' {web link}
    This add-on is very simple: on installation, it backs up
    and then resets your search preferences and home page
    to their default values, and then uninstalls itself. This
    affects the search bar, URL bar searches, and the home page.
    If you still have a problem, you may have add-ware on your system.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/viruses/disinfection/5350 Anti-Rootkit Utility - TDSSKiller]
    * [http://general-changelog-team.fr/en/downloads/viewdownload/20-outils-de-xplode/2-adwcleaner AdwCleaner] (for more info, see this [http://www.bleepingcomputer.com/download/adwcleaner/ alternate AdwCleaner download page])
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • The photos in my IPhoto have all become mini-thumbnails and I can't open or edit them. When I print the image it comes out normal size.  How do I get the thumbnails back to the standard size and be able to work with them?

    The photos in my IPhoto have all become mini-thumbnails and I can't open or edit them. When I print the image it comes out normal size.  How do I get the thumbnails back to the standard size and be able to work with the photo files?

    What version of iPhoto and system are you running?  On the guess that you're running the latest iPhoto, 9.4.2, Try the following:
    1 - launch iPhoto with the Command+Option keys held down and rebuild the thumnails, Option #2.
    2 - It may take 2-3 attempts so don't give up after only one attempt.
    OT

  • Help: will iMovie delete the videos from iPhoto when i get the thumbnails?

    i have lots of important videos on iphoto and i am afraid imovie might wipe out all of the videos when it gets the thumbnails. has this ever happened to anyone before?

    iMovie will not delete anything in iPhoto.

  • I want tabs to open at google.ca as they did before I got rid of the bing bar. Have gone to options and set it there but I still get the thumbnail page. Thx.

    Instead I get the thumbnail page which Id rather not have. I x'ed out all the thumbnails so only the google.ca one is there but it's not a full page, just a thumbnail. I realize I can enlarge it. This is not a huge problem but I would like it solved.

    Just to lay out the recipe all in one place:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste '''newtab''' and pause while the list is filtered
    (3) Double-click the '''browser.newtab.url''' preference and enter your preferred page:
    * ''Page thumbnails (default)'' => about:newtab
    * ''Blank tab'' => about:blank
    * ''Built-in Firefox home page'' => about:home
    * ''Any other page'' => full URL to the page
    Press Ctrl+t to open a new tab and verify that it worked. Fixed?
    Note: as per cor-el's suggestion, open the Google page you want and copy the "final" URL from the address bar to paste in when you update this setting. If you use a shortened version, then Google will send Firefox a redirect every time, which is a waste.

  • Getting the thumbnail images to pop out

    I'm using an AS3 photoviewer from <
    http://www.blog.noponies.com/archives/16>
    and I am trying to get the thumbnail images to pop out when rolled
    over.
    Can someone help me out or point me in the right direction.
    Please upload any modified zips or code here!

    Hi. I did a quick google on AS3 scale up, and yes that is the
    type of effect I would like.
    Like the scale effect on <
    http://www.flashmagazine.com/tutorials/detail/as3_photo_gallery/>,
    to go with the gallery I am using from <
    http://www.blog.noponies.com/archives/16>.
    Please help me or accordingly modify my file at <
    http://www.montreal2losangeles.com/pleasehelpscalethumbs.html>.
    Much appreciation and thanks in advance.

  • Why can't I get the image to view larger when you click on a thumbnail?

    I thought that there was a way to have the image open up larger in a new little window when you click the thumbnail on a photos page....when I click a thumbnail on my photos page it takes me right to slideshow view and the images are displayed too small to see fine detail (I am a retoucher, so my clients need to be able to see hi res images) I can't find a way to change the size of the slideshow images or to get my thumbnails to click open to a hi res version in a new window. The only solution I can think of is to use a blank template page, make each small image a link to a hidden page with the image at hi resolution....but this would take forever and I would have a gazillion pages on my site that way. Any idea how to get around this. Seems like the older version of iweb didn't have this problem...????
    (for an example of what I mean, my site: http://www.katesilsby.com (retouch page) and what old iweb did and what I want to happen: http://web.mac.com/vogier/iWeb/vivian%20ogier/wardrobe.html

    (for an example of what I mean, my site: http://www.katesilsby.com (retouch page) and what old iweb did and what I want to happen: http://web.mac.com/vogier/iWeb/vivian%20ogier/wardrobe.html
    iWeb2 photos page is completely different from that of iWeb1.
    iWeb2 photos page can be retro back to iWeb1, but not without major javascript coding.
    or using completely different previewing method for larger image, example: http://hdl.50webs.com/Lytebox/Photos.html

  • I just installed Elements 13. When I import images, most of them do not load as thumbnails, but rather as gray rectangles. When I double click on them, the image appears and can be edited. How do I get the thumbnail images to all appear?

    My System:
    iMac Software: OSX Yosemite v. 10.10.3
    Processor: 2.9GHz Intel Core i5
    Memory: 8GB 1600MHz DDR3

    If you are importing large numbers of images, it takes PSE a while to generate the thumbnails. So you might want to just wait while it does its thing (which can be hours if we're talking thousands of pics). If it's just  few images, select them in the organizer, then press F5 and see if that forces the  thumbnails to generate.

  • How do I get the thumbnail to display the cover of the magazine as opposed to the little pdf icon?

    My little pdf icon displays the pdf icon. I have seen on some computers that when you have a magazine pdf that it shows the front cover in the thumbnail spot. How do i turn this function on?   Many Thanks... Greg

    I have windows 7....newly installed and I am new to windows 7...my other computers have vista.

  • How can I get the print to be larger on iMac lion?

    I can barely read E mails he print is too small. Also on my home page, how do I make it bigger?

    In Mail, select the email so it is displayed, then hold down Command and press the = key. This should enlarge the view on-screen of the message. This is a step-increase - do it twice and it will get even larger. You can reduce it back by holding down Command and pressing the - key.
    The same key-press instructions work in Safari and most browsers.
    In Lion and Safari, if you are using a Magic Mouse you can also do a double-tap on the surface of the mouse with one finger - this should enlarge the view. A second double-tap will reduce it back to normal. Note that this is a double-tap, not a double-click.
    In all apps you can also hold down the Control key and use the scroll-up and scroll-down gesture on a Magic Mouse - the view will zoom and return accordingly.

  • On Craigslist, I cannot get the thumbnail images to change

    I open an entry on craigslist and it has multiple thumbnail images. When I click or pass the curser over the miniimages, nothing changes. Before all I had to do to change images was move the cursor over them.
    Is Firefox blocking this? I use Avast free antivirus. OS is Win XP Pro. on Dell desktop.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"

  • File upload script not getting the file name for larger files

    Hi
    I have the following code (see extract below) and find that
    when the size of the file to upload is larger than about 300kb the
    code does not grab the file name. Consequently the upload fails.
    The code works fine when the file size is smaller.
    The code in the form page is:
    <form
    action="UploadAttachment.asp?SubjectName=<%=Request.QueryString("SubjectName")%>&VersionN umber=<%=Request.QueryString("VersionNumber")%>&QualificationName=<%=Request.QueryString(" QualificationName")%>"
    method="post" enctype="multipart/form-data" name="form1">
    <input name="file" type="file" size="100">
    <input name="Upload" type="submit" id="Upload"
    value="Upload">
    </form>
    The code in the UploadAttachment.asp page is:
    <%
    'Grab the file name
    Dim objUpload, strPath, SQLString
    Set objUpload = New clsUpload
    'there is a problem that this next line doesn't grab the file
    name if file is too large.
    strFileName = objUpload.Fields("file").FileName
    etc.
    %>
    If you have any idea how to resolve this I'd be grateful.
    Neil

    Hi
    I have the following code (see extract below) and find that
    when the size of the file to upload is larger than about 300kb the
    code does not grab the file name. Consequently the upload fails.
    The code works fine when the file size is smaller.
    The code in the form page is:
    <form
    action="UploadAttachment.asp?SubjectName=<%=Request.QueryString("SubjectName")%>&VersionN umber=<%=Request.QueryString("VersionNumber")%>&QualificationName=<%=Request.QueryString(" QualificationName")%>"
    method="post" enctype="multipart/form-data" name="form1">
    <input name="file" type="file" size="100">
    <input name="Upload" type="submit" id="Upload"
    value="Upload">
    </form>
    The code in the UploadAttachment.asp page is:
    <%
    'Grab the file name
    Dim objUpload, strPath, SQLString
    Set objUpload = New clsUpload
    'there is a problem that this next line doesn't grab the file
    name if file is too large.
    strFileName = objUpload.Fields("file").FileName
    etc.
    %>
    If you have any idea how to resolve this I'd be grateful.
    Neil

  • How can I get the font to be larger on my Outlook Express?

    Yesterday, I was on my email Outlook Express....I'm not sure why, but the font became very small. I can't figure out how to make it a larger font so it will be easier to read.

    Note that you might have changed the page zoom via the keyboard shortcuts "Ctrl + +" and "Ctrl + -" or with the mouse scroll wheel when you pressed the Ctrl key.
    *https://support.mozilla.org/kb/how-do-i-use-zoom

  • How can I get the font to be larger in Facebook?

    I have made the adjustments in settings, but, aside from commenting on posts, where the larger font is evident, the Facebook newsfeed remains too small!

    Note that you might have changed the page zoom via the keyboard shortcuts "Ctrl + +" and "Ctrl + -" or with the mouse scroll wheel when you pressed the Ctrl key.
    *https://support.mozilla.org/kb/how-do-i-use-zoom

Maybe you are looking for

  • Text Wrapping issue in Long Texts in ECC 6.0

    Hi, We are migrating Tasklist data from SAP 3.1i system to SAP 6.0. So we were moving the existing Long Text in 3.1i with the same paramenters to 6.0, I am facing an issue of text Wrapping(while displaying). I am updating complete header data like -

  • Access to libraries denied

    My aperture 3 slowed to a crawl, so in order to speed it up I removed the com.apple.aperture.plist file, along with the library/caches files, restarted it all and now I get an error message when I try to select different libraries, effectively denyin

  • For what is used the Serializable?

    Hi! I'm wondering for what can I use the Serializable interface. Since it do not have methods or fields. Can you tell me for what it is used and provide a little example of it? Thanks a lot! Raul

  • Crashing at Startup with Waves AU

    I am crashing at startup with the waves plug ins. My system was fine before I started using Audio Units Manager. After that Logic will crash. So I trashed the prefs. trashed Audio Unit Manager and re installed the waves plugins and the waveshell AU d

  • I can't see airport express after iTunes re-install

    Hey you Windows guys, my daughter uninstalled iTunes by accident.  When I reinstalled it, I can't see the Airport Express (AE) any more.  It also doesn't show up in the Airport Utility.  This is what I've done to troubleshoot and more info: Windows 7