←Select platform

IntelligentDownScaleCommand Constructor(RasterImage,RasterColor,RasterColor,bool,bool,int,int,int)

Summary
Initializes a new IntelligentDownScaleCommand class object with explicit parameters.
Syntax
C#
C++/CLI
Python
public: 
IntelligentDownScaleCommand(  
   RasterImage^ maskImage, 
   RasterColor removeObjectColor, 
   RasterColor preserveObjectColor, 
   bool useRemoveObjectColor, 
   bool usePreserveObjectColor, 
   int newWidth, 
   int newHeight, 
   int downScalingOrder 
) 

Parameters

maskImage
RasterImage object that references mask image.

removeObjectColor
RasterColor value that specifies color of the area in the mask image in order to be removed and it has to be different than the rest of the image colors. If no remove color exist, then pass null.

preserveObjectColor
RasterColor value that specifies color of the area in the mask image in order to be removed and it has to be different than the rest of the image colors. If no remove color exist, then pass null.

useRemoveObjectColor
true to use the removeObjectColor parameter false otherwise.

usePreserveObjectColor
true to use the removeObjectColor parameter false otherwise.

newWidth
New width. Range from 1 to width of the image -1.

newHeight
New height. Range from 1 to height of the image -1.

downScalingOrder
value that determine whether the processing will start with the width first then the height or vice versa. Pass 0 to start with the height, pass 1 to start with the width.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.SpecialEffects; 
 
 
public void IntelligentDownScaleCommandExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Sample3.cmp")); 
 
   IntelligentDownScaleCommand command = new IntelligentDownScaleCommand(); 
   command.DownScalingOrder = 1; 
   command.NewWidth = image.Width - 100; 
   command.NewHeight = image.Height; 
   command.UsePreserveObjectColor = false; 
   command.UseRemoveObjectColor = false; 
 
   // Apply the intelligent downscale on the image. 
   command.Run(image); 
   codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IntelligentDownScaleResult.jpg"), RasterImageFormat.Jpeg, 24); 
 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.ImageProcessing.SpecialEffects Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.