Saving signed images with various output types
Leave feedback
Signature class supports saving of Image signed documents with various image format types and extended options.
Following classes are inherited from base classย SaveOptionsย and allows to specify additional output image format settings.
BmpSaveOptions class allows to save signed image document toย BMPย image format and setup additional options ( like compression, resolutions, bits per pixel etc);
GifSaveOptionsย class allows to save signed image document toย GIFimage format and setup additional options ( like compression, resolutions etc);
JpegSaveOptionsย class allows to save signed image document toย JPEGย image format and setup additional options ( like compression, resolutions, quality etc);
PngSaveOptionsย class allows to save signed image document toย PNGย image format and setup additional options ( like bit depth, color type, compression, filters etc);
TiffSaveOptionsย class allows to save signed image document toย TIFFย image format and setup additional options
Here are the steps to save signed Image document to special image output type with additional settings with GroupDocs.Signature:
Create new instance ofย Signatureย class and pass source document path or stream as a constructor parameter.
Callย Signย method ofย Signature class instance and pass signatureoptions andย SaveOptionsย objectย to it.
Save signed image as BMP
using(Signaturesignature=newSignature("sample.jpg")){QrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};SaveOptionssaveOptions;// create Bmp save options with advanced settingssaveOptions=newBmpSaveOptions(){AddMissingExtenstion=true,Compression=BitmapCompression.Rgb,HorizontalResolution=7,VerticalResolution=7,BitsPerPixel=16,OverwriteExistingFiles=true};// sign document to filesignature.Sign("signedSample",signOptions,saveOptions);}
Save signed image as GIF
using(Signaturesignature=newSignature("sample.jpg")){QrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};SaveOptionssaveOptions;// create Gif save options with advanced settingssaveOptions=newGifSaveOptions(){AddMissingExtenstion=true,BackgroundColorIndex=2,ColorResolution=7,DoPaletteCorrection=true,HasTrailer=true,Interlaced=false,IsPaletteSorted=true,PixelAspectRatio=24};// sign document to filesignature.Sign("SignedSample",signOptions,saveOptions);}
Save signed image as JPEG
using(Signaturesignature=newSignature("sample.jpg")){QrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};SaveOptionssaveOptions;// create Jpeg save options with advanced settingssaveOptions=newJpegSaveOptions(){AddMissingExtenstion=true,BitsPerChannel=8,ColorType=JpegCompressionColorMode.Rgb,Comment="signed jpeg file",CompressionType=JpegCompressionMode.Lossless,Quality=100,SampleRoundingMode=JpegRoundingMode.Extrapolate};// sign document to filesignature.Sign("SignedSample",signOptions,saveOptions);}
Save signed image as PNG
using(Signaturesignature=newSignature("sample.jpg")){QrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};SaveOptionssaveOptions;// create png save options with advanced settingssaveOptions=newPngSaveOptions(){AddMissingExtenstion=true,BitDepth=8,ColorType=PngColorType.Grayscale,CompressionLevel=9,FilterType=PngFilterType.Adaptive,Progressive=true};// sign document to filesignature.Sign("SignedSample",signOptions,saveOptions);}
Save signed image as TIFF
using(Signaturesignature=newSignature("sample.jpg")){QrCodeSignOptionssignOptions=newQrCodeSignOptions("JohnSmith"){EncodeType=QRCodeTypes.QR,Left=100,Top=100};SaveOptionssaveOptions;// create tiff save options with advanced settingssaveOptions=newTiffSaveOptions(){AddMissingExtenstion=true,ExpectedTiffFormat=TiffFormat.TiffNoCompressionBw};// sign document to filesignature.Sign("SignedSample",signOptions,saveOptions);}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourย GitHub examples: