←Select platform

StampBitsPerPixel Property

Summary
Gets and sets the bit depth for the stamp image.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int StampBitsPerPixel { get; set; } 
@property (nonatomic, assign) NSUInteger stampBitsPerPixel; 
public int getStampBitsPerPixel() 
public void setStampBitsPerPixel(int value) 
public: 
property int StampBitsPerPixel { 
   int get(); 
   void set (    int ); 
} 
StampBitsPerPixel # get and set (CodecsJpegSaveOptions) 

Property Value

The default value is 24.

The bit depth for the stamp image.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
 
using Leadtools.ImageProcessing.Core; 
using Leadtools.Pdf; 
 
public void CodecsJpegOptionsExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"); 
 
   // Get all Information about the Jpeg file that you want to load. 
   CodecsImageInfo imageInfo = codecs.GetInformation(srcFileName, true); 
 
   //Setting Jpeg Load options. CodecsJpegOptions & CodecsJpegLoadOptions reference 
   codecs.Options.Jpeg.Load.DisableMmx = false; 
   codecs.Options.Jpeg.Load.DisableP3 = false; 
   codecs.Options.Jpeg.Load.ForceCieLab = true; 
   codecs.Options.Jpeg.Load.ForceRgbFile = false; 
   codecs.Options.Jpeg.Load.IgnoreAdobeColorTransform = false; 
   codecs.Options.Jpeg.Load.UseBadJpegPredictor = false; 
   codecs.Options.Jpeg.Load.Multithreaded = true; 
   codecs.Options.Jpeg.Load.UseFastConversion = false; 
 
   RasterImage srcImage = codecs.Load(srcFileName); 
 
   //if the image has stamp then set the Jpeg settings related to the stamp. 
   if (imageInfo.Jpeg.HasStamp) 
   { 
      // Note, codecs.Options.Jpeg.Save.SaveWithoutTimestamp is deprecated. Use CodecsPngSaveOptions.SaveWithoutTimestamp instead. 
      // CodecsJpegSaveOptions reference 
      codecs.Options.Jpeg.Save.FixedPaletteStamp = true; 
      codecs.Options.Jpeg.Save.JpegStamp = true; 
      codecs.Options.Jpeg.Save.SaveWithStamp = true; 
      codecs.Options.Jpeg.Save.StampBitsPerPixel = srcImage.BitsPerPixel; 
      codecs.Options.Jpeg.Save.StampHeight = 100; 
      codecs.Options.Jpeg.Save.StampWidth = 100; 
      codecs.Options.Jpeg.Save.YccStamp = false; 
   } 
 
   if (imageInfo.Jpeg.IsLossless) 
      Debug.WriteLine("This is a lossless Jpeg Image"); 
   else 
      Debug.WriteLine("This is not a lossless Jpeg Image"); 
 
   if (imageInfo.Jpeg.IsProgressive) 
      codecs.Options.Jpeg.Save.Passes = 0; 
 
   codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.Custom; 
   codecs.Options.Jpeg.Save.DisableMmx = true; 
   codecs.Options.Jpeg.Save.DisableP3 = true; 
   codecs.Options.Jpeg.Save.QualityFactor = 2; 
   codecs.Options.Jpeg.Save.SaveOldJtif = true; 
 
   codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "jpeg1.jpg"), RasterImageFormat.Jpeg, srcImage.BitsPerPixel); 
 
   codecs.Options.Jpeg.Save.FixedPaletteStamp = false; 
   codecs.Options.Jpeg.Save.JpegStamp = true; 
   codecs.Options.Jpeg.Save.SaveWithStamp = true; 
   codecs.Options.Jpeg.Save.StampBitsPerPixel = srcImage.BitsPerPixel; 
   codecs.Options.Jpeg.Save.StampHeight = 75; 
   codecs.Options.Jpeg.Save.StampWidth = 50; 
   codecs.Options.Jpeg.Save.YccStamp = true; 
   codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.MaximumQuality; 
   codecs.Options.Jpeg.Save.DisableMmx = false; 
   codecs.Options.Jpeg.Save.DisableP3 = false; 
   codecs.Options.Jpeg.Save.SaveOldJtif = false; 
 
   codecs.Save(srcImage, Path.Combine(LEAD_VARS.ImagesDir, "jpeg2.jpg"), RasterImageFormat.Jpeg, srcImage.BitsPerPixel); 
 
   // Clean up 
   srcImage.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.File; 
import java.io.IOException; 
import java.net.URI; 
import java.net.URISyntaxException; 
import java.nio.file.Paths; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.imageprocessing.core.MinMaxBitsCommand; 
 
 
public void codecsJpegOptionsExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterCodecs codecs = new RasterCodecs(); 
   String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "cannon.jpg"); 
 
   // Get all Information about the Jpeg file that you want to load. 
   CodecsImageInfo imageInfo = codecs.getInformation(srcFileName, true); 
 
   // Setting Jpeg Load options. CodecsJpegOptions & CodecsJpegLoadOptions 
   // reference 
   codecs.getOptions().getJpeg().getLoad().setDisableMmx(false); 
   codecs.getOptions().getJpeg().getLoad().setDisableP3(false); 
   codecs.getOptions().getJpeg().getLoad().setForceCieLab(true); 
   codecs.getOptions().getJpeg().getLoad().setForceRgbFile(false); 
   codecs.getOptions().getJpeg().getLoad().setIgnoreAdobeColorTransform(false); 
   codecs.getOptions().getJpeg().getLoad().setUseBadJpegPredictor(false); 
   codecs.getOptions().getJpeg().getLoad().setMultithreaded(true); 
   codecs.getOptions().getJpeg().getLoad().setUseFastConversion(false); 
   RasterImage srcImage = codecs.load(srcFileName); 
 
   // if the image has stamp then set the Jpeg settings related to the stamp. 
   if (imageInfo.getJpeg().hasStamp()) { 
      // Note, codecs.getOptions().Jpeg.Save.SaveWithoutTimestamp is deprecated. Use 
      // CodecsPngSaveOptions.SaveWithoutTimestamp instead. 
      // CodecsJpegSaveOptions reference 
      codecs.getOptions().getJpeg().getSave().setFixedPaletteStamp(true); 
      codecs.getOptions().getJpeg().getSave().setJpegStamp(true); 
      codecs.getOptions().getJpeg().getSave().setSaveWithStamp(true); 
      codecs.getOptions().getJpeg().getSave().setStampBitsPerPixel(srcImage.getBitsPerPixel()); 
      codecs.getOptions().getJpeg().getSave().setStampHeight(100); 
      codecs.getOptions().getJpeg().getSave().setStampWidth(100); 
      codecs.getOptions().getJpeg().getSave().setYccStamp(false); 
   } 
 
   if (imageInfo.getJpeg().isLossless()) 
      System.out.println("This is a lossless Jpeg Image"); 
   else 
      System.out.println("This is not a lossless Jpeg Image"); 
 
   if (imageInfo.getJpeg().isProgressive()) 
      codecs.getOptions().getJpeg().getSave().setPasses(0); 
   codecs.getOptions().getJpeg().getSave().setCmpQualityFactorPredefined(CodecsCmpQualityFactorPredefined.CUSTOM); 
   codecs.getOptions().getJpeg().getSave().setDisableMmx(true); 
   codecs.getOptions().getJpeg().getSave().setDisableP3(true); 
   codecs.getOptions().getJpeg().getSave().setQualityFactor(2); 
   codecs.getOptions().getJpeg().getSave().setSaveOldJtif(true); 
   codecs.save(srcImage, combine(LEAD_VARS_IMAGES_DIR, "jpeg1.jpg"), RasterImageFormat.JPEG, 
         srcImage.getBitsPerPixel()); 
   codecs.getOptions().getJpeg().getSave().setFixedPaletteStamp(false); 
   codecs.getOptions().getJpeg().getSave().setJpegStamp(true); 
   codecs.getOptions().getJpeg().getSave().setSaveWithStamp(true); 
   codecs.getOptions().getJpeg().getSave().setStampBitsPerPixel(srcImage.getBitsPerPixel()); 
   codecs.getOptions().getJpeg().getSave().setStampHeight(75); 
   codecs.getOptions().getJpeg().getSave().setStampWidth(50); 
   codecs.getOptions().getJpeg().getSave().setYccStamp(true); 
   codecs.getOptions().getJpeg().getSave() 
         .setCmpQualityFactorPredefined(CodecsCmpQualityFactorPredefined.MAXIMUM_QUALITY); 
   codecs.getOptions().getJpeg().getSave().setDisableMmx(false); 
   codecs.getOptions().getJpeg().getSave().setDisableP3(false); 
   codecs.getOptions().getJpeg().getSave().setSaveOldJtif(false); 
 
   String outputFileName = combine(LEAD_VARS_IMAGES_DIR, "jpeg2.jpg"); 
   codecs.save(srcImage, outputFileName, RasterImageFormat.JPEG, srcImage.getBitsPerPixel()); 
 
   assertTrue("File unsuccessfully saved to " + outputFileName, (new File(outputFileName)).exists()); 
   System.out.printf("File successfully saved to %s%n", outputFileName); 
 
   // Clean up 
   srcImage.dispose(); 
   codecs.dispose(); 
} 
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.