T O P I C R E V I E W |
JoeHon |
Posted - Nov 17 2014 : 09:28:39 HI,
I need load 400 jpeg from a folder. I Hit a problem on performance. ImageEn 5.2, Delphi XE6 Update1
If I use fillfromdirectory, I can have a picture display in quick but when I press keyboard right arrow to navigate the image. it take time to do as it first time load(cache image) when display.
If I use Appendimage for 400 jpg with 300K per file size, it take ~30 SECOND TO DO.
I use below code: ImageEnMView1.LockPaint; Try for i := 1 to 400 do Begin ImageEnMView1.AppendImage(Format('%s_%.4d',[sPath,i])+'.jpg'); End; Finally ImageEnMView1.UnLockPaint; End
But I navigate left or right it is very smooth(this is result I need except the loading time).
Actually I need load a folder of picture in quick( that folder is video frame picture), I need move backward and forward to simulate the video motion smooth. Any advise on achieve this? As I use AppendImage , it take time to load, Any method to speed up?
|
2 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Nov 17 2014 : 12:03:56 Hi
Assuming your Storetype is ietNormal, then it will be slow because it loading 400 JPEG images into memory.
So, as Bill recommends, set StoreType to ietThumb or ietFastThumb, so only a thumbnail of the image is loaded.
Secondly, ensure you only load what is needed on screen, by using load on demand. With AppendImage use the overload with the LoadOnDemand parameter.
ImageEnMView1.AppendImage( Format( '%s_%.4d', [ sPath,i ]) + '.jpg', TRUE );
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
w2m |
Posted - Nov 17 2014 : 10:59:38 If I understand you correctly it would be best to use FillFromDirectory because that procedure is threaded. You could also try to increase the cache size so that more images remain in memory.
If you have a lot of memory then set the cache size to a higher level.
If not then do not use full images... use thumbnails so it will be faster. Then if you need the full image just load the full image into TImageEnView with LoadFromFile(ImageEnMView.MIO.Params.Filename).
TImageEnMView.ImageCacheSize
Declaration property ImageCacheSize: Integer;
Description Specifies the number of images to be stored in memory, rather than in a memory mapped file. For example, if you know that a TImageEnMView will only contain 20 images then the ImageCacheSize could be set to 20 to disable all memory mapping.
The default value is 10.
You could also maximize the use of threads by setting threadpoolsize TImageEnMView.ThreadPoolSize
Declaration property ThreadPoolSize: Integer;
Description Specifies how many threads can be created to load images (to load images in the background). If ThreadPoolSize is set to 0 all images are loaded in the main thread.
You can not have high speed with lots of large jpg files unless they are loaded as thumbnails and not the full image. You switch to loading thumbnails by using StoreType:
TIEStoreType
Declaration type TIEStoreType = (ietNormal, ietThumb, ietFastThumb);
Description Specifies how images are loaded.
Value Description ietNormal The full bitmap is kept in memory ietThumb A sub-sampled copy of the bitmap is kept in memory (of the size specified by ThumbWidth and ThumbHeight). ietFastThumb Only the cached image of the display thumbnail is held in memory. If the thumbnail is cleared from the cache it will need to be reloaded
ietThumb vs ietFastThumb
When using ietFastThumb, creation of the thumbnail is delayed until it is shown on screen. Prior to this a full size image of each frame may be held in memory. For this reason ietFastThumb should not be used unless thumbnail frames are being loaded on demand (or there is not a large amount of off-screen frames).
ietFastThumb can improve the quality of thumbnails, particularly when using ImageInfoText and ThumbnailClipping. It cannot be used if you have disabled image caching.
If you are using ietFastThumb then you should significantly increase the ImageCacheSize to something larger, such as 200.
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
|