←Select platform

Image Property

Summary
Gets the RasterImage object that references the affected image.
Syntax
C#
C++/CLI
Java
Python
public RasterImage Image { get; } 
public RasterImage getImage() 
public: 
property RasterImage^ Image { 
   RasterImage^ get(); 
} 
Image # get  (SmoothCommandEventArgs) 

Property Value

RasterImage that references the affected image.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing.Core; 
 
public void SmoothCommandEventArgsExample() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "clean.tif")); 
 
   // Prepare the command 
   SmoothCommand command = new SmoothCommand(SmoothCommandFlags.FavorLong | SmoothCommandFlags.SingleRegion | SmoothCommandFlags.LeadRegion, 2); 
   command.Smooth += new EventHandler<SmoothCommandEventArgs>(SmoothEventExample_S4); 
   command.Run(image); 
 
} 
 
private void SmoothEventExample_S4(object sender, SmoothCommandEventArgs e) 
{ 
   SmoothCommandEventArgs ee = new SmoothCommandEventArgs(e.Image, e.BumpNick, e.StartRow, e.StartColumn, e.Length, e.Direction); 
 
   string BumpOrNeck; 
   if (ee.BumpNick == SmoothCommandBumpNickType.Bump) 
      BumpOrNeck = "Bump"; 
   else 
      BumpOrNeck = "Neck"; 
 
   string Direction; 
   if (ee.Direction == SmoothCommandDirectionType.Horizontal) 
      Direction = "Horizontal"; 
   else 
      Direction = "Vertical"; 
 
   e.Status = RemoveStatus.Remove; 
 
   System.Diagnostics.Debug.WriteLine("The width of the image is: " + e.Image.Width + "\n" + "The height of the image is: " + e.Image.Height + "\n" + " Bump Or Neck : " + BumpOrNeck + "\n" + "Direction : " + Direction); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.assertTrue; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.*; 
 
 
public void smoothCommandEventArgsExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.setThrowExceptionsOnInvalidImages(true); 
 
   RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "clean.tif"), 1, CodecsLoadByteOrder.BGR, 1, 1); 
 
   // Prepare the command 
   SmoothCommand command = new SmoothCommand(SmoothCommandFlags.FAVOR_LONG.getValue() 
         | SmoothCommandFlags.SINGLE_REGION.getValue() | SmoothCommandFlags.LEAD_REGION.getValue(), 2); 
   command.addSmoothCommandListener(SmoothEventExample_S4); 
   int change = command.run(image); 
   assertTrue(change != RasterImageChangedFlags.NONE); 
 
   codecs.save(image, combine(LEAD_VARS_IMAGES_DIR, "clean.tif"), RasterImageFormat.JPEG, 24); 
   System.out.println("Command run and image saved to " + combine(LEAD_VARS_IMAGES_DIR, "clean.tif")); 
} 
 
SmoothCommandListener SmoothEventExample_S4 = new SmoothCommandListener() { 
   @Override 
   public void onSmoothEvent(SmoothCommandEvent e) { 
      e = new SmoothCommandEvent(e, e.getImage(), e.getBumpNick(), e.getStartRow(), e.getStartColumn(), 
            e.getLength(), e.getDirection()); 
 
      String BumpOrNeck; 
      if (e.getBumpNick() == SmoothCommandBumpNickType.BUMP) 
         BumpOrNeck = "Bump"; 
      else 
         BumpOrNeck = "Neck"; 
 
      String Direction; 
      if (e.getDirection() == SmoothCommandDirectionType.HORIZONTAL) 
         Direction = "Horizontal"; 
      else 
         Direction = "Vertical"; 
 
      e.setStatus(RemoveStatus.REMOVE); 
 
      System.out.println("The width of the image is: " + e.getImage().getWidth() + "\n" 
            + "The height of the image is: " + e.getImage().getHeight() + "\n" + " Bump Or Neck : " + BumpOrNeck 
            + "\n" + "Direction : " + Direction); 
   } 
}; 
Requirements

Target Platforms

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

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