LEADTOOLS Image Processing (Leadtools.ImageProcessing.Color assembly)
LEAD Technologies, Inc

PosterizeCommand Class

Example 





Members 
Imposes a poster effect on an image by quantizing the image's colors to a specified number of color levels per plane. For example, two levels means two of red, two of green, and two of blue. .NET support WinRT support Silverlight support
Object Model
PosterizeCommand Class
Syntax
'Declaration
 
Public Class PosterizeCommand 
   Inherits Leadtools.ImageProcessing.RasterCommand
   Implements Leadtools.ImageProcessing.IRasterCommand 
'Usage
 
Dim instance As PosterizeCommand
public sealed class PosterizeCommand : Leadtools.ImageProcessing.IRasterCommand  
function Leadtools.ImageProcessing.Color.PosterizeCommand()
Remarks

If the image has a LUT and you want to work on the image data, set RasterImage.UseLookupTable to false. Then, after calling the method, reset the UselookupTable property to true, as follows:

            rasterImage.UseLookupTable = false;
            Method(rasterImage);
            
            rasterImage.UseLookupTable = true;
            

For more information, refer to Applying Artistic Effects.

Example
 
Public Sub PosterizeCommandCommandExample()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   ' Prepare the command
   Dim command As PosterizeCommand = New PosterizeCommand
   'Apply a poster effect with twelve color levels per plane.
   command.Levels = 12

   command.Run(leadImage)
   codecs.Save(leadImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24)

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void PosterizeCommandCommandExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

      // Prepare the command
      PosterizeCommand command  = new PosterizeCommand();
      //Apply a poster effect with twelve color levels per plane.
      command.Levels   = 12;
      command.Run(image);
      codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
[TestMethod]
public async Task PosterizeCommandCommandExample()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;
   // Load the image
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   // Prepare the command
   PosterizeCommand command  = new PosterizeCommand();
   //Apply a poster effect with twelve color levels per plane.
   command.Levels   = 12;
   command.Run(image);

   string destFileName = @"result.jpg";
   StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName);
   await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Jpeg, 0);
}
public void PosterizeCommandCommandExample(RasterImage image, Stream outStream)
{
   // Prepare the command
   PosterizeCommand command  = new PosterizeCommand();
   //Apply a poster effect with twelve color levels per plane.
   command.Levels   = 12;
   command.Run(image);
   // Save result image
   RasterCodecs codecs = new RasterCodecs();
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
   image.Dispose();
}
Public Sub PosterizeCommandCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)
   ' Prepare the command
   Dim command As PosterizeCommand = New PosterizeCommand()
   'Apply a poster effect with twelve color levels per plane.
   command.Levels = 12
   command.Run(image)
   ' Save result image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
   image.Dispose()
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PosterizeCommand Members
Leadtools.ImageProcessing.Color Namespace
Applying Artistic Effects
Leadtools.ImageProcessing.Effects.SharpenCommand
Leadtools.ImageProcessing.Effects.MosaicCommand
Leadtools.ImageProcessing.Effects.EmbossCommand
Leadtools.ImageProcessing.Effects.AverageCommand
Leadtools.ImageProcessing.Core.MedianCommand
Leadtools.ImageProcessing.Effects.AddNoiseCommand
IntensityDetectCommand Class
Leadtools.ImageProcessing.Effects.SpatialFilterCommand
Leadtools.ImageProcessing.Effects.BinaryFilterCommand
Leadtools.ImageProcessing.Core.MaximumCommand
Leadtools.ImageProcessing.Core.MinimumCommand
Leadtools.ImageProcessing.Effects.OilifyCommand
SolarizeCommand Class
Leadtools.ImageProcessing.Core.WindowLevelCommand
Leadtools.ImageProcessing.SpecialEffects.BumpMapCommand
Leadtools.ImageProcessing.Effects.CubismCommand
Leadtools.ImageProcessing.SpecialEffects.DrawStarCommand
Leadtools.ImageProcessing.SpecialEffects.DryCommand
Leadtools.ImageProcessing.SpecialEffects.FreePlaneBendCommand
Leadtools.ImageProcessing.SpecialEffects.FreeRadialBendCommand
Leadtools.ImageProcessing.SpecialEffects.GlassEffectCommand
Leadtools.ImageProcessing.SpecialEffects.GlowCommand
Leadtools.ImageProcessing.SpecialEffects.LensFlareCommand
Leadtools.ImageProcessing.SpecialEffects.LightCommand
Leadtools.ImageProcessing.SpecialEffects.OceanCommand
Leadtools.ImageProcessing.SpecialEffects.PlaneBendCommand
Leadtools.ImageProcessing.SpecialEffects.PlaneCommand
SampleTargetCommand Class
Leadtools.ImageProcessing.SpecialEffects.TunnelCommand
Leadtools.ImageProcessing.SpecialEffects.BendCommand
Leadtools.ImageProcessing.SpecialEffects.CylinderCommand
Leadtools.ImageProcessing.SpecialEffects.FreeHandShearCommand
Leadtools.ImageProcessing.SpecialEffects.FreeHandWaveCommand
Leadtools.ImageProcessing.SpecialEffects.ImpressionistCommand
Leadtools.ImageProcessing.SpecialEffects.PixelateCommand
Leadtools.ImageProcessing.SpecialEffects.PolarCommand
Leadtools.ImageProcessing.SpecialEffects.PunchCommand
Leadtools.ImageProcessing.SpecialEffects.RadialBlurCommand
Leadtools.ImageProcessing.SpecialEffects.RadialWaveCommand
Leadtools.ImageProcessing.SpecialEffects.RippleCommand
Leadtools.ImageProcessing.SpecialEffects.SphereCommand
Leadtools.ImageProcessing.SpecialEffects.SwirlCommand
Leadtools.ImageProcessing.SpecialEffects.WaveCommand
Leadtools.ImageProcessing.SpecialEffects.WindCommand
Leadtools.ImageProcessing.SpecialEffects.ZoomBlurCommand
Leadtools.ImageProcessing.SpecialEffects.ZoomWaveCommand
Leadtools.ImageProcessing.SpecialEffects.ShadowCommand
Leadtools.ImageProcessing.SpecialEffects.RevEffectCommand
Leadtools.ImageProcessing.SpecialEffects.AgingCommand
Leadtools.ImageProcessing.SpecialEffects.DiceEffectCommand
Leadtools.ImageProcessing.SpecialEffects.FunctionalLightCommand
Leadtools.ImageProcessing.SpecialEffects.PuzzleEffectCommand
Leadtools.ImageProcessing.SpecialEffects.RingEffectCommand
Leadtools.ImageProcessing.SpecialEffects.RadialBlurCommand
Leadtools.ImageProcessing.SpecialEffects.BricksTextureCommand
Leadtools.ImageProcessing.Core.DeskewCommand
Leadtools.ImageProcessing.SpecialEffects.DiffuseGlowCommand
Leadtools.ImageProcessing.SpecialEffects.GlowCommand
Leadtools.ImageProcessing.Core.HalfTonePatternCommand
Leadtools.ImageProcessing.Effects.HighPassCommand
Leadtools.ImageProcessing.Effects.MaskConvolutionCommand
Leadtools.ImageProcessing.SpecialEffects.PerspectiveCommand
Leadtools.ImageProcessing.SpecialEffects.PlasmaCommand
Leadtools.ImageProcessing.SpecialEffects.PointillistCommand
Leadtools.ImageProcessing.SpecialEffects.CanvasCommand
Leadtools.ImageProcessing.SpecialEffects.CloudsCommand
Leadtools.ImageProcessing.SpecialEffects.ColoredBallsCommand
Leadtools.ImageProcessing.SpecialEffects.DiffuseGlowCommand
Leadtools.ImageProcessing.Effects.DisplacementCommand
Leadtools.ImageProcessing.SpecialEffects.FragmentCommand
Leadtools.ImageProcessing.SpecialEffects.MosaicTilesCommand
Leadtools.ImageProcessing.Effects.OffsetCommand
Leadtools.ImageProcessing.SpecialEffects.RomanMosaicCommand
Leadtools.ImageProcessing.SpecialEffects.VignnetCommand
Leadtools.ImageProcessing.SpecialEffects.ZigZagCommand

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.