Pictures and speed

Ralf Sander ralf at end-if.de
Sat Nov 6 02:32:35 CST 2004


> > I am planning a picture database with realbasic that should provide a
> > thumbnail view and made some quick tests with valentina to observe 
> the
> > best and fast way it could be done.
> >
> > 1. way
> > Storing all pictures in a temporary array is fast at display but slow
> > on request, because all pictures need to be decompressed at once and
> > also slow at sorts etc, because it needs to be refilled every time.
> > Also it takes a lot of ram.
> >
> > 2. way
> > Storing all pictures in an array, but only the viewed at request and
> > the not yet invisible in a following thread.
> > Ok, but a lot of work to eleborate on the scrollbar position etc to
> > create a smooth viewing experience.
> >
> > 3. way
> > Getting pictures from the db when they are needed (draw event):
> >
> > I tried with a standard listbox and the "backgroundpaint" event:
> >
> > Function CellBackgroundPaint(g As Graphics, row As Integer, column As
> > Integer) As Boolean
> > dim p as Picture
> > dim b as Boolean
> >
> > if column=0 then
> > p=NewPicture(30,30,32)
> > b=mDataBase.mPerson.GoToRecID(row)
> > p.graphics.DrawPicture mDataBase.mPerson.PictFld.GetPicture,0,0
> > g.DrawPicture p,0,0,30,30
> > end
> > return true
> >
> > End Function
> >
> > (I need to create a new picture here, because direct drawing draws
> > anywhere on the screen (bug?))
> > This solution is really to slow ( scrolling ). I think, because of 
> the
> > decompressing time for the pictures.
> >
> >
> > Have anyone any other idea, how I could realize this as fast as
> > possible.
>
> I wonder, do you use RB listbox ?
>
yes, but only for testing purposes. I want to use a thumbnail browser 
like e.g. in iPhoto
> You mean that you read from db only N pictures which should be drawed 
> now?
Yes, as many thumbs, as can be viewed simultaneously-see below.
> So I assume in the same time on screen can be shown 5-10-15 pictures, 
> yes?
this should be very variable ( like in iPhoto) beginning at 32x32 up to 
512x512. Average size is about 112x112. This browser already exists. 
I'm using at as a file browser. I get the icons or previews of the 
first simultaneous visible files and put them to an array. Then I load 
the others in a thread.
But I thougt in a database, it should be possible without a thread, 
because it seems possible in other database applications, too. (e.g. 
iPhoto-How do they do it?)
Also the cursor could contain all records in a database (Think of a 
call like "show all"), which could be thousands, and I don't want to 
load all pictures to an array.
Even in Filemaker, I can browse through a list of thumbnails without 
appreciable time loss. And here the pictures are compressed jpegs too, 
as far as I know.

To simplify testing for me ( I am new to databases, if you don't want 
to mention filemaker) , I started with the RB listbox, But the result 
is too slow.
I thought the slowness could be explained by a possibly slow 
(de)compressing, and tests with quicktime/jpeg class of MBS and a 
standard blob field actually came to a faster result, but still to 
slow.  (To your thougt, Fred, 16 bit do not change anything)


> When you scroll down only next new picture must be read from db and 
> shown
> Yes?
>
True for listbox, but in my thumbnail browser its even a complete new 
row with as many pictures as columns.



Cheers,
Ralf




More information about the Valentina mailing list