Results 1 to 11 of 11

Thread: Load images faster?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    94

    Question

    Maybe you guys (or girls) can help me out. I have an application that displays items in a listbox. The user can choose to associate a graphics file with each item. As they click through the list a small preview of the graphic is loaded into an image box. This works great until the graphics get to a large size. With jpegs at about 650 x 900 the loading is noticeably slow. Using smaller images helps, but I really want the images to stay large as they can also be viewed at their original size in the program. Any tips or pointers?

    Cthulhu Dragon

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    It will sure help if you post part of you codes. Are you using LoadPicture with an image control?
    Chemically Formulated As:
    Dr. Nitro

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    I would post if I could, but my code is at home and I am not.
    but, yes I am using the imagebox.picture = loadpicture("Blah") method
    I do this in response to the listbox click.

  4. #4
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Maybe you can have it load in one imagebox first but have that one hidden and when the user select that file, show that imagebox and hide the other one while loading the next picture into it.


    OR


    You can use the API BitBlt to paint the picture on.
    Chemically Formulated As:
    Dr. Nitro

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    I have several hundred entries each containing a picture and I have no way of knowing which will be the next one clicked.

    I have thought about bitblt, but was checking if there was a VB way. API it is!

    [Edited by CthulhuDragon on 08-03-2000 at 06:25 PM]

  6. #6
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Kedaman and Fox knows about this stuff. Send an email to them and I am sure they can help you out.
    Chemically Formulated As:
    Dr. Nitro

  7. #7
    Guest
    Keep in mind that BitBlt cannot stretch or shrink the image. It you would like to stretch it, than I suggest that you use the StretchBlt API.

    If you want to stay away from API, than the VB equivilent is PaintPicture. The disadvantage of this is that it's a little slower.

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Actually, it's Paintpicture that is faster than Stretchblt in stretching images, so don't use Stetchblt.

    Also, Loadpicture is the fastest way i can think of, use bitmaps instead of gif's or jpg's.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    I got a little curious so I did a little test to see what was faster and by how much. I used 2 picture boxes and 2 image boxes. I used paintpicture on the picture boxes and loadpicture on the image boxes. I loaded a 300k jpg into 2 boxes using each method, and a 3.5 MB bmp into the other boxes. They were the same picture one was simply saved as a bmp from a jpg. I used gettickcount before and after the load to see the difference.
    Here are the results (These are averages):
    JPG using paintpicture - .31s
    JPG using loadpicture - .297s
    BMP using paintpicture - .063s
    BMP using Loadpicture - .078s

    So basically the only real difference comes in using BMPs instead of JPGs. But the downside is in diskspace usage.

    Cthulhu Dragon

  10. #10
    Guest
    Kedaman: Stats have shown that StretchBlt is faster.

    CthulhuDragon: For the most part, those stats are right, but keep in mind that you can give or take 3ms or so on each result. (It's only a fractional amount so don't worry about it)

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Then you have the wrong Stats Meg, probably because you have Autoredraw messing around; I have done tests on this, Paintpicture is roughly 25% faster.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width