public bool AdjustStampSize { get; set; }
@property (nonatomic, assign) BOOL AdjustStampSize;
public boolean getAdjustStampSize()
public void setAdjustStampSize(boolean value)
AdjustStampSize # get and set (CodecsSaveOptions)
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. |
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}");
}
}
CodecsJpegSaveOptions.StampWidth, CodecsJpegSaveOptions.StampHeight
CodecsPngSaveOptions.StampWidth, CodecsPngSaveOptions.StampHeight
CodecsWebpSaveOptions.StampWidth, CodecsWebpSaveOptions.StampHeight
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document