<< Click to Display Table of Contents >> Using BLOB's or other Temporary Images / Memory Streams |
If you want to import images which are for example BLOB's from a database, we recommend to write these BLOB's as temporary files to harddisk and to import them into VPE using the standard Picture() method. For editions below the Professional Edition, this is the best solution, because this way the dynamic image cache of VPE will be used and no memory and / or performance problems will occur.
NOTE: | You may not delete or overwrite image files, which are currently used in any open document of your application. For a detailed explanation, please see “Image Cache”. |
If you are using the Professional Edition or higher, you can also use Memory Streams to import images from BLOB’s by using the PictureStream() method. This is faster since it does not involve any disk I/O overhead. But in order to keep memory consumption as low as possible, you should always supply the SAME memory stream to the PictureStream() method for the same picture. If you do so, VPE can also make use of its image cache, i.e. identical memory streams will be moved into the cache only once. VPE creates internally copies of a memory streams, so it cannot remove memory stream based images from the cache as long as a document is open (it can not reload the image), you should only make use of this technique, if the amount of images (and their size) is not too large. Otherwise too much memory is consumed and the technique of using temporary files is the better choice.
The usage of Memory Streams is explained in the Reference Manuals.