Efficient loading and rendering of multiple images: Need advice

I have an application that allows the user to customize and display full-screen consoles of various information. The console can have a background image. Additionally, the console can contain any number of components...one of which is a "Image" component.
Both the console background and the image component can refer to multiple images...if multiple images are referenced, the displayed image switches every X seconds.
The application has a repository into which users can load their images so that they are managed by the app.
Now, my problem:
In the old version of my application, I loaded ALL images into memory at startup and when users added them to the repository. This way, each image was available for display very quickly. When it needed to be displayed, I'd just scale it appropriately and display it. Problem is that this used a LOT of memory...I have the full image in memory AND the scaled image in memory.
In the newer version of my application, I now load images from disk on demand. When an image needs to be displayed, it's loaded from disk, scaled and displayed. This uses MUCH less memory...but I'm finding that it's slow and can block my user interface from updating...
I guess I'm probably looking at something in between where I cache the images that MIGHT be displayed by a console. That's better than loading ALL images into memory, and it's better than ALWAYS going to disk. It's just a matter of the logic around finding out what images need to be loaded...loading them in a background thread, blah blah blah.
Anyone had to deal with a problem like this? Any suggestions?
Here's my class that acts as the proxy to the image on disk:
public class ImageProxy extends PersistentComponent {
     public static final long serialVersionUID = 1L;
     public static final String PROP_URL = "URL";
     private URL url;
     public ImageProxy (URL url, String name) throws InstantiationException {
          this.setName(name);
          this.setURL(url);
     public void setURL (URL url) {
          URL oldURL = this.url;
          this.url = url;
          this.changes.firePropertyChange(PROP_URL, oldURL, url);
     public static ImageProxy createImageProxy(File file, XMLParseLog parseLog)
               throws InstantiationException {
          parseLog.inform("Creating new image");
          parseLog.right();
          ImageProxy newImageProxy = null;
          try {
               newImageProxy = new ImageProxy(file.toURL(), file.getName());
               newImageProxy.setSizeOnDisk(file.length());
               newImageProxy.setLastModified(new Date(file.lastModified()));
          } catch (InstantiationException e) {
               parseLog.error(e.getMessage());
               parseLog.left();
               throw e;
          } catch (MalformedURLException e) {
               parseLog.error(e.getMessage());
               parseLog.left();
               throw new InstantiationException(e.getMessage());
          parseLog.left();
          return newImageProxy;
      * Returns the theImage.
      * @return ImageIcon
     public BufferedImage getImage() {
          try {
               return ImageIO.read(this.url);
          } catch (IOException e) {
               return new BufferedImage(100,100,BufferedImage.TYPE_INT_RGB);
     public URL getURL() {
          return url;
}The other option (and it's an easier option) I was thinking of was to have the image proxy class cache the BufferedImage itself upon the first request.
That way, only used images are loaded into memory. I could also then have a thread that would occasionally sweep through all the image proxies and clear out the buffered images of the ones that haven't been requested in X minutes.
Edited by: jneau on May 18, 2008 7:38 PM
Edited by: jneau on May 18, 2008 7:45 PM

I had a similar problem, but with prepared SQL statements--Our solution was similar to your last comment. Without going into the details, we basically made a circular queue that cached the prepared statements, in the system we were using a the time you could only have a set number of prepared statements--and it was not very many, the queue had an aging function so when we had to have a new prepared statement we would use the handle to the one that had the most ancient last referenced time. In this manner we made sure that those statements that were being referenced frequently were the ones that were available.
This does have a few weaknesses:
1 - you still have to stringently manage your limited resources, in your case you're going
to have to tune and do trial and error to find that sweet spot to balance your app.
2 - if you have a bunch of 1 timers, then there is no benefit.

Similar Messages

  • Fully loaded and rendered external SWF printing problem.

    I have an application that loads external SWF files that I have not built and do not have the codebase for.
    I need to know when these SWFs are fully loaded and have rendered themselves on the screen.
    Even gone to the point of giving them 80 enter frame events before trying to print and they show up on the paper sporadically.
    Does anyone know if there's some standard event coming from some object internal to SWFLoader that would let me know when the SWF is "running?"

    There is no way to know in the general case.  If it had an animation of
    birds flying around on it, when would be the right time to print it?

  • How to load and save a Bitmap Image?

    Hi, I have to load a directory of bitmap images, take the background(in this case: light green) and then swap those exact pixels with another image's corresponding pixels, and then save them in the same format(bitmap) in a different directory. Can anybody advise me on which libraries I need to use, and how I should approach this? I need help with every step so any help will be good. Thanks. Basically I need to do the following:
    1. Load 2 directories of images(Lets say the images are corresponding like Image1A and Image1B)
    2. Take Image1A's green pixels and swap them with the corresponding Image1B's pixels.
    3. Save Image1A in a new Directory.
    This will go on for however many images there are in those 2 directories. Can anybody advise me how to do this? I need critical help in all three stages. Thanks.
    Edited by: Taufiq on Feb 25, 2008 9:10 AM

    Taufiq wrote:
    Doesn't java handle bitmap images? Does it HAVE to be gif etc. ?
    Edited by: Taufiq on Feb 25, 2008 10:17 AMI'm not familiar with windows-specific stuff, but ImageIO supports additional image readers/writers. You should google.
    Edit: Actually, I just checked and ImageIO comes with readers and writers for both BMP and WBMP files:
    http://java.sun.com/javase/6/docs/api/javax/imageio/package-summary.html

  • I get an error message that says library not loaded and the reason is image not fund.  I have reloaded IDVD and also done an update but still have the same problem.  Anyone have any ideas on how to fix it?

    I get an error message that says "Dyld error Message:  Library not loaded @rpath/ilifeslideshowcore.framework/versions/a/ilifeslideshowcore"  the reason: image not found
    Anyone have any idea how to fix this problem.  I have reloaded the software from the original disk and have downloaded the latest update and still get the same error.

    Did you delete all receipts with iDVD in the file name  with either a .PKG or .BOM extension that reside in the HD/Library/Receipts folder and from the /var/db/receipts/  folder before installing the new copy?  If not then do so and delete the new application also.
    Click to view full size
    Then install iPhoto from the disk it came on originally and apply all necessary updaters: Apple - Support - Downloads
    OT

  • Upgrading Unity 4.0.5 to version 8 and replacing the server. Need advice for most efficient upgrade path.

    Hello,
    I need to upgrade Unity 4.0.5 without failover to Unity 8, and we are replacing the server as well.
    What would be the most efficient upgrade path for this?
    Thanks!!

    Brian,
    The most efficient path is to use COBRAS.  I have a number of posts explaining the overall process.  At the highest-level, this allows you to build out the new Unity 8x environment, get it integrated with AD/Exchange, and then build out configurations that don't migrate over (there are a few which are highlighted in the COBRAS help).  From there, you migrate data over from the 4x system.  There may or may not be a few steps along the way but they are outlined in numerous posts I've contributed to regarding COBRAS and also in the COBRAS Help which is located at www.ciscounitytools.com.
    Hailey
    Please rate helpful posts!

  • Store takes forever to load and when it does images fail and text is not setup right?

    So I thought I had troubles loading the store with itunes, but now I notice it does load just takes forever and when it does the images are broken and the text is linear, not spread correctly like the page would have set it up.  I have tried all the proxy/DNS flush suggestions that the site offers, I have even reinstalled intunes.  I know it is not my provider because the wife's computer loads the store just fine.  My only guess is that there is something I have done to disable itunes from working right or the fact that me and the wife use same provider but are not setup as a home network, any help would be great!

    My girlfriend is having the same issue w/ Vista since she updated to iTunes 9. Can't figure out the problem for the life of me and contacted support and they sent me here. Basically the HTML on the store isn't loading properly and it takes forever for the text just to load. Anybody got some suggestions? I'm sure I'm just missing something...

  • How To Perform The Same Edit And Crop To Multiple Images?

    On just one image this would be a no brainer, I'd just use the paint brush or similar tool to wipe over a section I want covered and use the crop tool to get the image size and position I'm after. The thing is though, I'd like to do the same edit and crop to a series of photos to keep them all consistent and it's beyond me how to do that in PS5. When I look at help I find tips on using scripts, batch processing or stacking images that seem to defy the English language and don't address the two simple little things I want to do to these images.
    Can anyone explain, or point me to a resource, that could help me accomplish what I'd like to think should be a simple task for such an expensive program?
    Greg

    You could use a "clipper" document to isolate the globe in each image.
    Create a clipper doc which is the size of the images in the globe series and which contains only a layer with a silhouette of the globe surrounded by transparency.
    Make an Action which will copy the current image and close it, paste into the already open clipper doc, clip that image layer to the silhouette layer, crop/trim, export a file then revert the clipper doc to its initial state of just the silhouette ready for processing the next image in the batch. For example:
    1. Select All
    2. Copy
    3. Close
    4. Paste
    5. Create Clipping Mask
    6. Trim based on transparent pixels
    7. Save As
    8. Revert
    Open the clipper doc then set up Batch so the output files are named with a serial number.

  • Can I load and skip through multiple playlists on iPod shuffle 2nd gen?

    For the sake of this discussion, let's assume I have a workout playlist and a dining jazz playlist in iTunes.
    Q1: I understand that I can manually select "a" playlist in iTunes and move that to my iPod shuffle. And I understand how to manually order the songs to be stored in that same order on the shuffle. Can I move both playlists and have both ordered they I way I choose in iTunes? I am assuming yes.
    Q2: Once both playlists exist on the shuffle, can I skip between playlists? Is there a short cut key or key sequence on the shuffle to do this? I understand the shuffle button to use shuffle or not shuffle. I want to play only workout songs while working out and jazz while dining. Or do I have to download songs from iTunes before I workout and then again before dining to only get the playlist I want for that activity?
    Thanks.
    mac os   Mac OS X (10.4)   iPod shuffle 2nd generation
    mac os   Mac OS X (10.4.8)  
    mac os   Mac OS X (10.4.8)  

    For the sake of this discussion, let's assume I have
    a workout playlist and a dining jazz playlist in
    iTunes.
    Q1: I understand that I can manually select "a"
    playlist in iTunes and move that to my iPod shuffle.
    And I understand how to manually order the songs to
    be stored in that same order on the shuffle. Can I
    move both playlists and have both ordered they I way
    I choose in iTunes? I am assuming yes.
    Assuming is always dangerous... the answer is NO. ONLY if you combine BOTH lists by dragging the contents of teh second one onto the Shuffle will you have ALL the songs on the Shuffle.
    Q2: Once both playlists exist on the shuffle, can I
    skip between playlists? Is there a short cut key or
    key sequence on the shuffle to do this? I understand
    the shuffle button to use shuffle or not shuffle. I
    want to play only workout songs while working out and
    jazz while dining. Or do I have to download songs
    from iTunes before I workout and then again before
    dining to only get the playlist I want for that
    activity?
    You can't skip to a different "playlist" directly... you can only go to the beginning of teh Shuffle's stored songs by 3 quick presses of PLAY. Otherwise you can skip back and forth with the |<< and >>| buttons.
    Thanks.

  • Dell Backup and Recovery - Factory Recovery fails, need advice.

    Back story:
    I have tried this three times on three separate laptops, with poor results. Windows 7 on two of them and 8.1 one one, on all three the recovery partition is corrupt.I first boot it off of a live disk and backup any desired files. Then I boot, press F8, choose "Repair your computer" and discover that "Dell Factory Image Restore" is not one of the available options... so I boot the pc off of a different live disk and remove a bunch of "viruses", then I boot it off of the internal harddrive.In Windows I find that "Dell Backup and Recovery" may or may not be on the pc. It may or may not have ever been run before. If it is absent I download it and install it. When I run DBaR it tells me it needs to update, don't power off or disconnect the machine from the internet, etc. I then wait HOURS for this part to complete. When done it...
    This topic first appeared in the Spiceworks Community

    Country: Greece
    Ship date: March 04, 2013
    XPS 14 (L421X, Mid 2012)
    EMEA (Europe, Middle East and Africa) Support is not provided on the USA User Forum. You have to contact support in your country.
     Dell Backup and Recovery SOFTWARE support is also not provided here.
            Download Dell Backup and Recovery

  • CC update is REALLY confusing and problem filled... need advice please

    I have 2 macs. On one, I just clicked on the update all in the CC desktop notification...what a mistake that was! LR would not work at all and PS installed a new version and (I think) updated my old version. But the new version does not have all my plugins working with it - it asked me if I wanted to migrate something (presets or something) and I said yes, but that did not seem to work either.
    My question are:
    1- do I really want to update Photoshop CC AND Photoshop cc 2014???
    2- is there no way to just update the existing version so all the plugins work without an hour or so of figuring out how to reinstall  them???
    The LR problem I finally solved by downloading 5.5 manually and manually installing over the bad CC desktop install.
    whew... what a bungle from Adobe...they are so proud of their new glitzy Web site and new apps and can't even update existing ones with out disaster... I've turned off auto download forever !!!
    thanks for the help and for letting me vent ... so much anxiety and wasted time...
    cheers,
    tom

    The main cause of slow system is due to certain heavy applications running in the background
    We agree on that.
    or because of duplicate and hidden files.
    Files visible, hidden, the same as other files, do not do anything, unless they happen to cause the disk to be completely or nearly full.  Otherwise they are just 1's and 0's.  They are passive (speaking as a paid file system developer).
    These files can't be easily removed.
    If they can't be removed, then they are essential to the proper operation of the operating system (such as /private/var/vm/swapfie(s)).  And if you have huge swapfile(s), then it is an indication of running too many RAM hungry apps concurrently, or a Mac that could use more RAM.
    So I think using speed up Mac software is the best solution.
    Hang around these forums long enough and you will see that in many cases those speed up, clean up, anti-malware apps "ARE" the "certain heavy applications running in the background" to use your own words.  It has been the experience of the long time forum contributors that once these 3rd party utilities are removed, most performance issues and system panics go away.

  • Batch "Place" gets off center after multiple images

    This is sort of a hard one to explain.  I'm trying to place a border and watermark over multiple images through the Place command.  The image that I'm using to place is a .psd file with transparent background.  The main images are tiff files.  The problem is, that after a number of images that are changed, the placed image (border/watermark) gets off center by a few pixels each time and I end up with a border shifting to the right.  How can I fix this?  Here is my process:
    1.  Create action
    2.  Resize image to 1200x1800px 300dpi.
    3.  "Place" border/watermark image over top of main image.  Center Position is 600px and 1200px.  Scale 100.1% for each side
    4.  Flatten Image
    5.  Sharpen
    6.  Close action
    7.  I then select multiple images via Bridge and go to "Batch" or "Image Processor" and run it.
    8.  Over multiple images, the placed image "creeps" to the right by a pixel or two each image.
    Is there something I'm doing wrong here?  The placed image is the exact same size and orientation as the original images.

    Ahh this is a huge help.  This problem has been a thorn in my side for months.  Thank you for the quick answer.  Here is the list of my steps now...
    1.  Resize background image to whatever I need
    2.  Place overlay image (border/watermark) and "enter"
    3.  Select All
    4.  Layer > Align layers to selection > Vertical Centers
    5.  Layer > Align layers to selection > Horizontal Centers
    6.  Flatten Image
    Works great, as long as the placed image is the same size as the background image.

  • Multiple Image Upload not working on macs

    Hello everybody,
    I have searched everywhere for an answer to this issue and I'm not sure if there is a solution yet.
    I am hoping someone reads this and tells me if either I need to use another product or post a fix for this to work.
    I am developing a website for a photographer who needs to upload the pictures he takes for his clients to review on his website.
    So on the backend I have created an application where he logs in and creates a new client and then uploads multiple images to that client's folder.
    I am of course developing the site in ADDT version 1.0.1. in Dreamweaver CS4.
    Everything works as expected except for the image upload part, where he is unable to upload even a single image.
    He is using Mac OS X and Safari 3 to access his site.
    I use a PC and can upload images perfectly, but the whole purpose of the website is for him to be able to upload images without me.
    I read somewhere that ADDT's Multiple Image upload did not work on Macs because of the way that the OS handles image uploads to the server via HTTP. I also know that Flash v.10 had an issue with this behaviour in the past, but that it's been fixed with ADDT's v. 1.0.1, which is true since as I said I am able to upload images from my PC using that Flash version.
    There is a product called MultiPowUpload from Element-IT (http://www.element-it.com/MultiPowUpload.aspx) that seems to do the exact same thing as ADDT's Multiple Image Upload, and I have tested the Demo version both on Mac and PC and works perfectly well.
    I really would like my ADDT behaviour to work, first because I already have the whole site developed in it, plus I am used to the software already, and also because Element-IT's product is a bit pricey for a multiple server license (which I would need for other sites I plan to develop for Mac users).
    Any thoughts or pointers you might have will be greatly appreciated.
    Thank you in advance.
    Luis Herrero.

    Thanks a lot for your replies and helpful ideas.
    It turns out that for some strange reason the problem was with the hosting provider.
    I have moved another site which was not working with Macs either to a new provider and everything works now as it should be, without changing any files at all.
    I have in fact v.1.0.1 in both those sites (those were the first things I checked before posting here) and Flash Player v. 10 both on the Mac and PC, so it will remain a mystery as to why the server behavior did not work with that particular host on Macs.
    Thanks again.
    Best regards.

  • Loading three consecutive external bitmap images

    Hi,
    My question is very simple.  I just want to know that when loading three consecutive images in a row (via LOADER() and URLREQUEST()), if I only need to watch for the completion of the last image load.  Or, will all three files load simultaneously (the smallest file completing first)?
    Also, is the following relatative URL acceptable?
    "../../Usifb/Images/Photos/Animations/WheelFreeTractor.png"
    Regards,
    Ron

    There is no telling what order the files will be loaded unless you control the order by loading them sequencially.  To load them sequencially you need to have a listener for each one.

  • How to paste exposure setting to multiple images

    Hi all:
    I know this question has probably been asked many times but I couldn't find any answer using the search so please be patient with me. :)
    I came from the world of RawShooter Premium and I realized that my version of RSP can't read RAW file from the Canon 30D so I got the Adobe Lightroom to process my images. All is well until I decide to paste the exposure setting from one image to multiple images. I know there is a copy and paste button in the "develop" mode but it doesn't paste the settings (color temp, exposure, noise, etc) to all the images even when I highlighted the images I want to paste. I can do that in RSP, which save a lot of time.
    Can anyone shed some light on this? I would really appreciate it.
    Thanks in advance.
    Ben

    In develop, copy and paste only works on the selected image. You can sync or auto sync (control-sync) there.
    If you want to copy and paste to multiple images using shift-control-C and shift-control-V, you can do that in grid mode.

  • Applying settings preset to multiple images in ACR v4.3

    When attempting to apply a preset to multiple images in ACR, the preset is only applied to the "current" or "active" image. The other images in the thumbnail pane remain unchanged, even though they are selected. This function works correctly in Bridge, but not in ACR. "Synchronizing" the files does not do the same thing, as my preset incorporates "Apply auto tone adjustments." What am I missing?

    Pardon my misunderstanding of the question. I just tried it, and the method of selecting the images has no impact (e.g., the "select all" button, or hold "shift" or "ctrl" and click on multiple images...)
    All the boxes are checked in the "synchronize" dialog. However, this synchronizes all of the settings to the "active image," which ties the tone adjustments to that image, which is undesirable. I just want to automatically adjust the tones (as part of my preset) to all of the selected images.
    Based upon input from this tread, this is the refined procedure I use to "check" if it's working (which hasn't for me so far):
    1) Select multiple images (or all, if you prefer)
    2) Apply "camera raw defaults" Note that the settings default to Blacks: +5, Brightness: +50, Contrast: +25
    3) Apply a saved preset (saved with the check box "Apply auto tone adjustments" checked).
    4) Note that the Blacks, Brightness, and Contrast sliders only "adjust" for the "active" image, but don't change for the other selections. They remain at Blacks: +5, Brightness: +50, Contrast: +25
    Again, if I perform this procedure in Bridge, it works for all selected images. However, in ACR, it functions as described above.
    Does that clear it up?
    Thanks for the prompt responses so far. I hope I'm simply doing something incorrectly!

Maybe you are looking for

  • Iweb website not showing up at all on any search engine

    Hello, I recently switched from Windows to a Mac (and its a big improvement, really pleased with it). As we run 2 tiny businesses, one of my first projects was to make 2 websites in iweb and publish them via ftp to the domains I purchased (both hoste

  • Nvidia Settings not saved or dont load after reboot

    Hi there , look well i try to put the follow settings : Well during my current session that apply without problems , well when i reboot , or shutdown after i power on the pc . the settings are reset to : How i can saved and load the settings when i s

  • How is DNotesBal Calculated?

    How is OCRD.DNotesBal calculated relative to vendors? We had an instance where we ordered two items from a vendor and ended up returning one of them. The vendor said to keep the remaining item at no cost because its value was too small to bother with

  • Party in a b2b Communication.

    All, I am currently involved in getting a naming conventions document for a landscpae that has more B2B scenario. Think of B2B and the first think that comes to mind is "Party" . I know you create the Party in the Integration Directory and then add t

  • JDBC Insert

    hi folks, I have a oracle table with USER_ID as primary key. Using JDBC i m trying to insert a row with same USER_ID and hence violating primary key rule. try { stat.executeUpdate(SQL); catch(SQLException ex) Now JDBC throws me a sql Exception, with