Re: need a thumbnail browser without memory limitations



Hi Peter,

When you are working with media files, you need to decide how you are going to limit the memory requirements of your app. For display pictures, you can take approaches that limit the memory requirements such as minimal caching. The viewport ( aka the display part of your app) can only show so many pictures at a time. So lets' say the user can see 10 pictures at once. If they have thousands of pictures there is no point loading more than 30 or so. The 30 being the page before and page after the current viewport page. That gives you rapid response to small scroll movements. When they do large scrolls, you probably should delay loading pages, as they may well be scrolling through that page not pausing to look at it. For that, fire a short delay timer to see if the scroll position is the same, then load the new viewport display page. This gives you the ability to have the app have the appearance of smooth scrolling without actually loading everything.

No doubt the usual trolls will flame me for suggesting this, but if you are early on in the app, I would seriously consider writing it in .NET as you will come across less limitations and have far richer libraries on hand. You can use GDI+ reasonably well in VB6, it is easier in VB.NET, but this kind of app sounds like it is well suited to WPF which has a lot of directX built in. But the real features I'd be using is multithreading and the ..NET memory management model. For example, lets say you need to load the next 10 thumbnails as the user scrolls. You can start another thread that then gets the ten after that to improve visual performance as they continue to scroll. So multi threading will be a great aid. You can also cache thumbnails using weak references. A weak reference lets the object be disposed and cleaned up if memory requirements for a garbage collection. So you check to see if the weak reference IsAlive, and if it is get the Target and use that, if not then load the thumbnail as you initially did. I honestly don't know how you'd achieve that in VB6



"Peter" <-> wrote in message news:eaJ7tY6VJHA.1456@xxxxxxxxxxxxxxxxxxxxxxx
Dear all

I like to write a image processing app and need a kind of thumbnail browser to select the images.
I thought I could prevent reinventing the wheel by using this code
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6029&lngWId=1
but I found out that there are limitations.
It uses one picturebox as a container for the thumbnails(picturebox-array) and a vscrollbar to move this container over the screen. I saw that this solution limits me to few not more that about 90 thumbnails, each about 400X300 pixels. The limit comes because a picturebox can not be bigger than 16384.
Then I started to make investigations about the used memory and saw that if I execute the following code,
for i=0 to foundfiles-1
load picthumb(i)
set picthumb(i).Picture=picTest.Image
next i
the application crashes after about 800pictures were loaded.
This means that I can't load all my pictures(in a size of about 400X300 pixels) in memory to show them in the thumbnail browser.
My question now is: How do I need to design a thumbnail browser that can display an unlimited # of thumbnails? With unlimited I mean perhaps 8000 to 10000 jpgs.
I made some tests with Irfanview(freeware), it had no problems to load that many thumbnails.
Do I need to make use of temporary files to avoid memory limitations?
Does anyone have a good reference code or at least a concept how I need to design my app?
Regards
Peter



.



Relevant Pages

  • Re: need a thumbnail browser without memory limitations
    ... The point is you need to be managing the memory. ... If they are using small scroll you can allow for acceleration on that, but consider that always as a request to display all pictures. ... And would myidea work to load 5000 pictureboxes, leave them empty but draw the DIBs onto them to for easy movement and receiving click events? ... The conversion to DIBS was from when he wanted to create and save to memory thumbnails of all the jpg files he was dealing with, because he wanted to draw those thumbnails extremely rapidly. ...
    (microsoft.public.vb.general.discussion)
  • Re: Thumbnails
    ... >> The app will show on user request a small window, ... The pictures are shown within an Image control ... >> of memory, but only a smaal part of it. ... >> How can I convert picturefiles to small thumbnailfiles? ...
    (microsoft.public.vb.general.discussion)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.misc)
  • =?windows-1252?Q?http=3A=2F=2Fwww=2Eelectronics=2Dmac=2Dsony=2Ecom_Kodak_EasyShare_?= =?windows&
    ... Product Features and Technical Details ... Keep your special pictures close without filling your internal ... Reduce blur caused by camera shake or subject movement. ... your camera’s internal memory ...
    (rec.photo.digital)