I wrote a drawing tool program by using vb6.
I scans a big house plan (A3 size) and load many little pictures as the element of the house.
The user can manipulate the house plan and saved it back.

I used normal vb6 method to load and save the picture, by using loadpicture and savepicture method. My problem is the saved picture is as large as 5 mb and the load picture requires very big amount of graphic memory and it will cause "out of memory" error whenever the computer doesn't have enough memory to start it. It takes up to 1 minute for a fast computer to load, and that is very slow.

Also I have a memory leak problem, although I have called loadpicture = "" whenever I want to "unload" picture from the picturebox whenever I close the form. I have close all the database recordset that I opened too.

I makes me need to restart my computer for every 3 times of the program executions because I will have out of memory problem for the 4th time.

Is there any third party program? or any suggestions to reduce the saved image size and to load the picture more efficiently?


5 Years
Discussion Span
Last Post by JeffBennett

Is there any third party program? or any suggestions to reduce the saved image size and to load the picture more efficiently?

The problem is that VB 6 SavePicture always saves uncompressed images ( BMP )
One option is to save the picture in a compressed format like JPG, GIF, PNG.
There are several OCX components you can use in your VB 6 application to do this.

Here are a couple
ImageMan - by Data Techniques
This may be very useful for you because it has image scanning built in
and the ability to adjust the scanned image - crop, adjust brightness
adjust contrast, rotate ( in case the image was scanned at an angle)..
Also you can read and write a very large number of image format
Image Man is very reliable and has been around for a long time.

MetaDraw - by Bennet-Tec Information Systems
First let me be up front - this component is produced by my company.
That said, MetaDraw may be of interest to you because it will
not only support saving to GIF, JPG, PNG, but it is also ideal
for your application in terms of allowing users to move objects
around within a drawing canvas. You already seem to have that
part of your application built, but you may find MetaDraw helpful
in that in addition to storing in compressed formats as noted above
you can also store in MetaDraw MDP format that will allow reloading and
still recognize the independent parts of the image so user can continue
to drag objects around after reloading. Unfortunately the MDP
format is not compressed so you might use GIF, JPG, or PNG
for save to publish, and MDP for Save for editing.

There are many other OCX components for VB 6 out there to support compression.
Another is Lead Tools www.leadtools.com/sdk/compression, just search on Google and you'll find many.

I hope this is helpful

Jeff Bennett

* Bennet-Tec Information Systems, Inc
* www.Bennet-Tec.Com

RELIABLE Component Software
and Custom Software Development Services

TList™ / ALLText™ / MetaDraw™ / Web Signature™

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.