←Select platform

AdjustStampSize Property

Summary
Indicates whether adjust the stamp size to fit inside the stamp width x height rectangle.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public bool AdjustStampSize { get; set; } 
@property (nonatomic, assign) BOOL AdjustStampSize; 
public boolean getAdjustStampSize() 
public void setAdjustStampSize(boolean value) 
public: 
property bool AdjustStampSize { 
   bool get(); 
   void set (    bool ); 
} 
AdjustStampSize # get and set (CodecsSaveOptions) 

Property Value

Value Description
true To automatically adjust the stamp size so it fits inside the stamp width x stamp height rectangle.
false (Default) The stamp size will be unchanged and black bars might be added to the size if necessary.
Remarks

The default value for this property is false.

When images with stamps, you can set this property to true if you wish to automatically adjust the stamp size to fit inside the specified stamp width x stamp height rectangle. This would make the stamp have the same aspect ratio as the image and avoid black bars being added to the side.

Example

static void TestSaveWithStamp() 
{ 
   string srcFile = @"IMAGE2.CMP"; 
   string dstFile = @"out.jpg"; 
 
   using (RasterCodecs codecs = new RasterCodecs()) 
   { 
      using (RasterImage image = codecs.Load(srcFile, 1)) 
      { 
         codecs.Options.Jpeg.Save.StampBitsPerPixel = 24; 
         codecs.Options.Jpeg.Save.StampWidth = 240; 
         codecs.Options.Jpeg.Save.StampHeight = 200; 
         codecs.Options.Save.AdjustStampSize = true; // make the stamp fit within the 240x200 rectangle 
         codecs.Options.Jpeg.Save.QualityFactor = 20; 
         codecs.Options.Jpeg.Save.SaveWithStamp = true; 
         /* Save an image with a stamp no bigger than 240 x 200 */ 
         codecs.Save(image, dstFile, RasterImageFormat.Jpeg, 0); 
      } 
 
      CodecsImageInfo info = codecs.GetInformation(dstFile, true); 
      Console.WriteLine($"{Path.GetFileName(dstFile)} - HasStamp = " + info.HasStamp); 
 
      if(info.HasStamp) 
         using(RasterImage image = codecs.ReadStamp(dstFile, 1)) 
            Console.WriteLine($"{Path.GetFileName(dstFile)} - stamp size = {image.Width} x {image.Height} x {image.BitsPerPixel}"); 
   } 
} 
Requirements

Target Platforms

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

Leadtools.Codecs Assembly

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