ImagXpress 13 for ActiveX - User Guide > Concepts > Save Memory |
If you need to figure out approximately how many bytes an image takes up in memory, multiply the image’s width in pixels times the height, times the color depth and divide by 8. If the image is the current image (ProcessImageID), the image size is available by reading the IFileSize property.
To reduce memory usage with ImagXpress®, try the following:
Resize Images
If you are displaying the image scaled down, you may want to resize the image to that size instead of using the ZoomToFit method or AutoSize property.
Reduce Bit depth
You can use the ColorDepth method to reduce the bit depth of the image. Use the UniqueColors method to count the colors in the image, without damaging the image. For 2 colors, use 1-bit color. For 16 colors or less, you can use 4-bit color. For 256 colors or less, you can use 8-bit color.
Compress in Memory
Set the CompressInMemory property to store the image in memory in a compressed mode. Note that when CompressInMemory is True, ImagXpress slows down, since memory must be compressed and uncompressed whenever a buffer is used.
Don't undo
The UndoEnabled property saves an uncompressed copy of the DIB. If you want to undo without incurring this memory usage, save the image to file or buffer in a compressed format like PNG, instead of using the UndoEnabled property. Then, when you need the undo image, load it into ImagXpress.
Monitor progress
Enable the Progress event to notify the application of progress made during loading, saving, or image processing. The Progress event is enabled by calling EventSetEnabled (EVENT_PROGRESS).