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 : Thursday, December 21, 2006 10:30:42 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


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.
File Attachment(s):
API - v15 - Combine Tiles by Strips.zip (50kb) downloaded 247 time(s).
 

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 : Monday, July 14, 2008 9:26:15 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


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).
File Attachment(s):
NET - v15 - Combine Tiles by Strips.zip (20kb) downloaded 253 time(s).
 
#3 Posted : Tuesday, March 13, 2012 12:35:52 AM(UTC)

Ibrahim  
Guest

Groups: Guests
Posts: 3,022

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

I've updated this project to use the LEADTOOLS v17.5 in C# using Visual Studio 2008.
File Attachment(s):
NET_v175_CombineTilesbyStrips.zip (15kb) downloaded 226 time(s).
 
#4 Posted : Tuesday, March 13, 2012 12:38:10 AM(UTC)

Ibrahim  
Guest

Groups: Guests
Posts: 3,022

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

I've updated this project to use the LEADTOOLS v17.5 C DLL APIs using Visual Studio 2008.
File Attachment(s):
CDLL_v175_CombineTilesbyStrips.zip (26kb) downloaded 226 time(s).
 
#5 Posted : Wednesday, May 24, 2017 9:40:29 AM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

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

Updated to use LEADTOOLS v19 in C# using Visual Studio 2017
File Attachment(s):
NET_v19_CombineTilesbyStrips.zip (17kb) downloaded 256 time(s).

Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
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.070 seconds.