ビット数が異なる画像を合成できますか?
対象製品
LEADTOOLS 17.5J Imaging Pro
詳細
2つの画像データを合成する機能として以下のクラスがあります。
CombineCommandクラスはディスティネーション画像の上に直接ソース画像を合成します。
サンプルコード(VB.NET)
サンプルコード(C#)
- Leadtools.ImageProcessing名前空間 : CombineFastCommandクラス
合成する画像のビット数は同じ(24ビットなら両方24ビット、1ビットなら両方1ビット)である必要があります。 - Leadtools.ImageProcessing.Effects名前空間 : CombineCommandクラス
合成する画像のビット数が異なる場合でも合成できます。
CombineCommandクラスはディスティネーション画像の上に直接ソース画像を合成します。
サンプルコード(VB.NET)
' ディスティネーション画像をビューワにロードします。 RasterImageViewer1.Image = codecs.Load("DestImg.tif") ' ソース画像をロードします。 Dim tempImage As RasterImage = codecs.Load("SourceImg.tif") ' ソース画像の合成する箇所をリージョンに変換します。 tempImage.AddRectangleToRegion(Nothing, New LeadRect(100, 100, 200, 200), RasterRegionCombineMode.Set) ' 合成します。 Dim combine As New Leadtools.ImageProcessing.Effects.CombineCommand combine.SourceImage = tempImage combine.DestinationRectangle = New LeadRect(0, 0, tempImage.ImageWidth, tempImage.ImageHeight) combine.SourcePoint = LeadPoint.Empty combine.Flags = Leadtools.ImageProcessing.Effects.CombineCommandFlags.OperationAdd Or Leadtools.ImageProcessing.Effects.CombineCommandFlags.Destination0 combine.Run(RasterImageViewer1.Image)
サンプルコード(C#)
// ディスティネーション画像をビューワにロードします。 rasterImageViewer1.Image = codecs.Load("DestImg.tif"); // ソース画像をロードします。 RasterImage tempImage = codecs.Load("SourceImg.tif"); // ソース画像の合成する箇所をリージョンに変換します。 tempImage.AddRectangleToRegion(null, new LeadRect(100, 100, 200, 200), RasterRegionCombineMode.Set); // 合成します。 Leadtools.ImageProcessing.Effects.CombineCommand combine = new Leadtools.ImageProcessing.Effects.CombineCommand(); combine.SourceImage = tempImage; combine.DestinationRectangle = new LeadRect(0, 0, tempImage.ImageWidth, tempImage.ImageHeight); combine.SourcePoint = LeadPoint.Empty; combine.Flags = Leadtools.ImageProcessing.Effects.CombineCommandFlags.OperationAdd | Leadtools.ImageProcessing.Effects.CombineCommandFlags.Destination0; combine.Run(rasterImageViewer1.Image);
関連情報
キーワード
画像処理 合成