Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

HOW TO: Combine image "tiles" into one image using minimal memory
Started by GregR at 12-21-2006 15:35. Topic has 9 replies.

Print Search « Previous Thread Next Thread »
  12-21-2006, 15:35
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,806
HOW TO: Combine image "tiles" into one image using minimal memory

Attachment: API - v15 - Combine Tiles by Strips.zip
Reply Quote
This sample application shows how to use the LEADTOOLS v15 API to treat and combine four images as "tiles" into a larger image.  In other words, you have four images: 1, 2, 3, 4 which are part of a larger image that should look like this: 12 34 If you can't picture it exactly, take a look at 1.tif, 2.tif, 3.tif, 4.tif, and combined.tif from the attached project to see what your input and output (combined.tif) actually look like.

In the case that these images are very large, such as 5000x5000, the resulting image of 10,000x10,000 would take up a VERY large chunk of memory, around 300MB.  This demo can combine these four images and only use about 5.5 MB of memory because it will load and save the file row by row.

In summary, this will show you how to:
1. Use L_SaveFile with a FILESAVECALLBACK function.
2. Use L_LoadFileTile to create a partial bitmap in memory from a file.  This is what allows you to use minimal memory when loading the files 1, 2, 3, and 4.
3. Use L_GetBitmapRow to copy only a single row of a bitmap into a buffer. 4. Combine and/or create very large images using hardly any memory.

There are some limitations of this sample:
1. It only works with 24bpp images.  If you want this to work on images of a different bpp, then you will need to make sure that they have the combined image you are saving has the same palette as the images you are loading.
2. It only works with four images named 1, 2, 3, and 4, which will get combined as mentioned before.  They must be the same size and file format.  To combine them in a different order or use more images, you will have to change the logic around in the FILESAVECALLBACK.
3. Depending on the file format, it could still take a long time to execute because of how much compression/decompression is needed.  For 5000x5000 Uncompresseed RGB tifs, it took about 45 seconds.  The same images saved as Lossless JPEGs took about 15 minutes.
Greg Ross
LEADTOOLS Technical Support
   Report 
  01-23-2008, 16:24
Sunitha is not online. Last active: 1/23/2008 9:23:10 PM Sunitha

Not Ranked
Joined on 01-23-2008
Posts 1
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
Can this be done fo Jpeg images as well?
   Report 
  01-24-2008, 8:58
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,806
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
Yes.
Greg Ross
LEADTOOLS Technical Support
   Report 
  07-14-2008, 11:13
jonny is not online. Last active: 7/14/2008 4:02:30 PM jonny

Not Ranked
Joined on 07-14-2008
Posts 5
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
:p,

Is this available in v15 C# APIs?
If it is, it will be a huge help to our application.

-Jonny
   Report 
  07-14-2008, 14:31
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,806
Re: HOW TO: Combine image "tiles" into one image using minimal memory

Attachment: NET - v15 - Combine Tiles by Strips.zip
Reply Quote
Here's a C# version.  This is also hard coded for the four simple TIF images, so you'll need to add some bullet proofing if you intend on using other formats, bpp, image sizes, etc.

In the .NET libraries, you use: RasterCodecs.Save, RasterCodecs.SaveImage event, RasterImage.GetRow, and RasterImage.Load (one of the overloads which takes a Rectangle).

Greg Ross
LEADTOOLS Technical Support
   Report 
  07-14-2008, 14:39
jonny is not online. Last active: 7/14/2008 4:02:30 PM jonny

Not Ranked
Joined on 07-14-2008
Posts 5
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
Wow, that's great!
and thanks for making up the sample in such a short time Greg!

If this could work, we will definitely going to upgrade to V15!



   Report 
  12-01-2008, 3:28
edypion is not online. Last active: 12/11/2008 2:15:26 PM edypion

Top 200 Posts
Joined on 03-09-2007
Posts 15
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
Does this apply to 14.5 lead tool version.. if not do you have any solution for it?
   Report 
  12-01-2008, 9:55
Adam Boulad is not online. Last active: 1/6/2009 1:25:47 PM Adam Boulad



Top 10 Posts
Joined on 09-16-2007
Posts 537
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
This should work with v14.5 also. Try to convert it to v14.5 and if you face problems with it, please create a new forum post and provide exact details of the problems you are facing.
Adam Boulad
LEADTOOLS Technical Support

   Report 
  12-19-2008, 14:14
impichit is not online. Last active: 12/17/2008 3:15:53 PM impichit

Top 500 Posts
Joined on 12-09-2008
Posts 13
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
Please modify code to support this Ref : http://support.leadtools.com/SupportPortal/CS/forums/25540/ShowPost.aspx

Thanks.
   Report 
  12-19-2008, 14:35
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,806
Re: HOW TO: Combine image "tiles" into one image using minimal memory
Reply Quote
At this time we cannot do this because we require more details from you before we can even attempt it.  Please respond to the questions on your original post.

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » General » Example Request... » HOW TO: Combine image "tiles" into one image using minimal memory

Powered by Community Server, by Telligent Systems