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 : Wednesday, February 9, 2011 6:33:53 AM(UTC)

amurray  
amurray

Groups: Registered
Posts: 12


The attached project demonstrates the problem. How can I change the code to support constructed images of arbitrary size?
 

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 : Thursday, February 10, 2011 2:53:02 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

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

There is no attachment with this post. If you want to attach file/images, put them in a ZIP or RAR file, and don't use the Preview option when attaching.
If you don't want to put your files on our forums, you can send them to support@leadtools.com and mention this post in your email.
Also, please do not include any of our LEADTOOLS DLLs or headers in your attachment.
 
#3 Posted : Thursday, February 10, 2011 3:47:57 AM(UTC)

amurray  
amurray

Groups: Registered
Posts: 12


.
File Attachment(s):
LeadLargeImages.zip (7kb) downloaded 23 time(s).
 
#4 Posted : Thursday, February 10, 2011 9:32:25 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

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

I tried your project and our toolkit did not crash. The pages kept getting added to the RasterImage object, with each page increasing the memory use by a little less than 15 Megabytes, which is the size of each bitmap (width * height * 4 bytes = 1700*2200*4).

After a number of loops that depends on the amount of free memory used by the bitmaps, the ConvertFromImage function triggered an exception.

This is normal because you will always have a limit on the number of bitmaps you can hold in memory at the same time.

Is there a reason why you want hundreds of bitmaps held in the same RasteImage object simultaneously? Regardless of what your application does with multiple pages, there are usually ways to handle these pages without keeping them all in memory together. If you give me more details about your requirements, I might be able to suggest alternative techniques.
 
#5 Posted : Thursday, February 10, 2011 3:42:47 PM(UTC)

amurray  
amurray

Groups: Registered
Posts: 12


I'm building a RasterImage object from each page sent to the virtual printer during a print job. I take each page event, build a bitmap, add it to the RasterImage, and dispose of the bitmap.

Some of those print jobs are hundreds of pages, and some users expect to work with over 1000 pages at a time. At the end of a print job, the RasterImage object is saved to disk as a multi-page TIF and passed along to another program.

The requirements for the resulting file are to contain every page sent (none missing due to out-of-memory exceptions), and to be a single multi-page 1bpp G4 TIF containing all the individual pages. That is, a 1000 page printed document must generate a 1000 page TIF, not 1000 single-page TIFs. I'm open to any suggestion that would satisfy those requirements.
 
#6 Posted : Saturday, February 12, 2011 11:57:51 PM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,034

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

It will be much faster and less error prone if you do it as follows:
1. When the first page in the print job arrives, create a new TIFF file and save the first page in it as TIFF CIITT Group4 then free the RasterImage object immediately.
2. When other pages in the same print job arrive, call RasterCodecs.Save with the same file name, but using a page mode of CodecsSavePageMode.Append, then free the RasterImage object again.

This means at any one point in time, you will only have one page in memory, but all pages will be saved to disk into one big file.
Our CCITT Group 4 compressor is very fast and it should be able to append the pages while the print job is still being processed.
 
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-2020, Yet Another Forum.NET
This page was generated in 0.138 seconds.