Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, November 30, 2009 2:40:59 PM(UTC)
TEngberg

Groups: Registered
Posts: 9


A separate Issue: When loading the ImageList Thumbnails for Documents with many pages 100+ I'm running out of Memory. How can this be done without using up the memory?

This example works fine for 1 to 25 Pages, but when I try to load 100+ pages into the ImageList I run out of memory.

The Basic Code is as follows:
Where DocArray is an array of 100+ single page Tiff Files like:
"C:\test\Image1.tif"
"C:\test\Image2.tif"
"C:\test\Image3.tif"
...........
"C:\test\Image100.tif"
... or more...


On my Control I have the following:
LTimageList1 - LEAD tools RasterImageList
LTviewer1 - LEAD tools RasterImageViewer


Example to load the Images Array to the ImageList.

RasterCodecs.Startup()
Dim LTcodecs As RasterCodecs = New RasterCodecs()

For index = 1 To UBound(DocArray)

Dim LTimage As RasterImage = New RasterImage(LTcodecs.Load(DocArray(index), 64, CodecsLoadByteOrder.BgrOrGray, 1, 1))

Dim LTitem As RasterImageListItem = New RasterImageListItem(LTimage, 1, "Page: " & index.ToString())

If index = 1 Then
LTitem.Selected = True
LTviewer1.Image = LTimage
End If

LTitem.FileName = DocArray(index)
LTimageList1.Items.Add(LTitem)

LTitem = Nothing

' I tried Disposing the Raster Images, which fixed the memory issue but gave me an Exception "No Pages in this image."
'LTimage .Dispose()

Next

LTcodecs.Dispose()
RasterCodecs.Shutdown()
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, December 2, 2009 5:49:42 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

If you don't need the full-size images to stay in memory all the time, you can load smaller copies in the image list. To do that, you can use the RasterCodecs.Load() overload that takes width and height parameters.

Also, is the second parameter 64-bit? If yes, this increases the memory requirements. Are your images 64 bits per pixel or is there a reason you're loading them this way?

Note:
You can load the images without constructing the RasterImage. This means instead of this:
Dim LTimage As RasterImage = New RasterImage(LTcodecs.Load(...))
You can use this:
Dim LTimage As RasterImage = LTcodecs.Load(...)
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.093 seconds.