Saving signed images with various output types
Leave feedback
On this page
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: