LEADTOOLS Support
Imaging
Imaging SDK Examples
How-To: Combining Multiple Images into a Single One
#1
Posted
:
Thursday, October 19, 2017 4:08:26 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
For images which have been split apart across multiple files, LEADTOOLS can be used to consolidate them into one composite image. Here's how to use the CombineCommand to recreate an image previously divided.
https://www.leadtools.com/help/leadtools/v19/dh/pe/combinecommand.htmlCode:
using (RasterCodecs codecs = new RasterCodecs())
{
RasterImage left = codecs.Load("cropthird.jpg");
RasterImage center = codecs.Load("cropthird2.jpg");
RasterImage right = codecs.Load("cropthird3.jpg");
RasterImage newImage = new RasterImage(RasterMemoryFlags.Conventional, left.Width + center.Width + right.Width, left.Height, 24, RasterByteOrder.Rgb, RasterViewPerspective.BottomLeft, null, null, 0);
CombineCommand cc = new CombineCommand();
cc.SourceImage = left;
cc.DestinationRectangle = new LeadRect(0, 0, left.Width, left.Height);
cc.Run(newImage);
cc.SourceImage = center;
cc.DestinationRectangle = new LeadRect(left.Width, 0, center.Width, center.Height);
cc.Run(newImage);
cc.SourceImage = right;
cc.DestinationRectangle = new LeadRect(left.Width + center.Width, 0, right.Width, right.Height);
cc.Run(newImage);
codecs.Save(newImage, "combinedimage.jpg", RasterImageFormat.Jpeg, 0);
}
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Imaging
Imaging SDK Examples
How-To: Combining Multiple Images into a Single One
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.