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 : Tuesday, December 17, 2019 12:19:47 PM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

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

Attached is a simple .NET Core application that shows how to load and merge images into a single output image.

Here is the relevant code:
Code:
static void Merge(MergeFile[] mergeFiles, string outputFile, RasterImageFormat outputFormat)
      {
         using RasterCodecs codecs = new RasterCodecs();
         RasterImage image = null;
         try
         {
            foreach (var mergeFile in mergeFiles)
            {
               if (image == null)
                  image = codecs.Load(mergeFile.FileName, 0, CodecsLoadByteOrder.BgrOrGray, mergeFile.FirstPage, mergeFile.LastPage);
               else
                  image.AddPages(codecs.Load(mergeFile.FileName, 0, CodecsLoadByteOrder.BgrOrGray, mergeFile.FirstPage, mergeFile.LastPage), mergeFile.FirstPage, mergeFile.LastPage);
            }

            codecs.Save(image, outputFile, outputFormat, 0);
         }
         finally
         {
            image.Dispose();
         }
      }


Code:
         MergeFile mergeFile1 = new MergeFile
         {
            FileName = @"C:\Users\Public\Documents\LEADTOOLS Images\ocr1-4.tif",
            FirstPage = 1,
            LastPage = -1
         };

         MergeFile mergeFile2 = new MergeFile
         {
            FileName = @"C:\Users\Public\Documents\LEADTOOLS Images\ocr1-4.tif",
            FirstPage = 1,
            LastPage = -1
         };

         Merge(new MergeFile[] { mergeFile1, mergeFile2 }, @"C:\Temp\out.tif", RasterImageFormat.TifJpeg411);


File Attachment(s):
MergeTiffs.zip (2kb) downloaded 45 time(s).
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 

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.

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.038 seconds.