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.