--- title: "Extracting Images of Signatures" slug: "extracting-images-of-signatures" updated: 2024-10-15T12:56:25Z published: 2024-10-15T12:56:25Z canonical: "docs.onespan.com/extracting-images-of-signatures" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Extracting Images of Signatures [Java SDK](/v1/docs/extracting-images-of-signatures#java-sdk) [.NET SDK](/v1/docs/extracting-images-of-signatures#net-sdk) [REST API](/v1/docs/extracting-images-of-signatures#rest-api) [APEX SDK](/v1/docs/extracting-images-of-signatures#apex-sdk) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/extract-signature-image-java-sdk/) site. You can extract the signature image for any Sender in your account. When doing so, note the following: - The default signature image size is 350 x 100 pixels. - If the sender does not exist or the sender does not have a captured signature, an error.notFound.userNotFound exception will be thrown. - If the image type is invalid or not supported, an error.validation.signatureImageType exception will be thrown. - Images can be in PNG, JPEG, or GIF format. - This procedure will only work for signatures of the CAPTURE type. ### Extracting Signature Images To extract a sender's signature as an image file, call on the SignatureImageService and pass the sender id and the format you wish to download the signature in. The following code will do this: ```java DownloadedFile senderImage = eslClient.getSignatureImageService().getSignatureImageForSender("{senderId}", SignatureImageFormat.PNG); byte[] senderImageByte = senderImage.getContents();         FileOutputStream stream = new FileOutputStream("C:/Users/hhaidary/Desktop/senderImage.png");         try {   stream.write(senderImageByte); } finally {   stream.close(); } ``` Then, open a new FileOutputStream to write the data to a destination of your choice. For more information on retrieving sender information, see [Managing Senders](/v1/docs/sharepoint-managing-senders#java-sdk). ### Extracting a Specific Signature Image To download a specific signer’s captured signature from a specific transaction, use the on the SignatureImageService to pass the package id, signer id, and the format you wish to download the signature in. The following code will do this: ```java PackageId packageId = new PackageId("IP-lS6_GYWlKr4moDNWMEWJOuJc=");         DownloadedFile signerImage = eslClient.getSignatureImageService().getSignatureImageForPackageRole(packageId,"signer1", SignatureImageFormat.JPG); byte[] signerImageByte = senderImage.getContents();         stream = new FileOutputStream("C:/Users/hhaidary/Desktop/signerImage.png");         try {   stream.write(signerImageByte); } finally {   stream.close(); } ``` ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/extract-signature-image-net-sdk/) site. You can extract the signature image for any Sender in your account. When doing so, note the following: - The default signature image size is 350 x 100 pixels. - If the sender does not exist or the sender does not have a captured signature, an error.notFound.userNotFound exception will be thrown. - If the image type is invalid or not supported, an error.validation.signatureImageType exception will be thrown. - Images can be in PNG, JPEG, or GIF format. - This procedure will only work for signatures of the CAPTURE type. ### Extracting Signature Images To extract a sender's signature as an image file, call on the SignatureImageService and pass the sender id and the format you wish to download the signature in. The following code will do this: ```csharp DownloadedFile senderImage = eslClient.SignatureImageService.GetSignatureImageForSender("rNs5hVUQ0mQY", SignatureImageFormat.PNG); byte[] senderImageByte = senderImage.Contents;   try {    File.WriteAllBytes("C:/Users/hhaidary/Desktop/senderImage.png", senderImageByte); } catch(Exception e) {    Debug.WriteLine(e); } ``` Then, open a new file to write the data to a destination of your choice. For more information on retrieving sender information, see [Managing Senders](/v1/docs/sharepoint-managing-senders#java-sdk). ### Extracting a Specific Signature Image To download a specific signer’s captured signature from a specific transaction, use the on the SignatureImageService to pass the package id, signer id, and the format you wish to download the signature in. The following code will do this: ```csharp PackageId packageId = new PackageId("IP-lS6_GYWlKr4moDNWMEWJOuJc="); DownloadedFile signerImage = eslClient.SignatureImageService.GetSignatureImageForPackageRole(packageId,"signer1", SignatureImageFormat.JPG); byte[] signerImageByte = senderImage.Contents; try {    File.WriteAllBytes("C:/Users/hhaidary/Desktop/signerImage.png", signerImageByte); } catch (Exception e) {    Debug.WriteLine(e); } ``` ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/extract-signature-image-rest-api/) site. You can extract the signature image for any Sender in your account. When doing so, note the following: - The default signature image size is 350 x 100 pixels. - If the sender does not exist or the sender does not have a captured signature, an error.notFound.userNotFound exception will be thrown. - If the image type is invalid or not supported, an error.validation.signatureImageType exception will be thrown. - Images can be in PNG, JPEG, or GIF format. - This procedure will only work for signatures of the CAPTURE type. ### Extracting Signature Images The following code will do this: #### HTTP Request ```http GET /api/account/senders/{senderId}/signatureImage ``` `GET /api/account/senders/{senderId}/signatureImage` #### HTTP Headers ```http Accept: image/png,image/jpeg,image/gif Content-Type: application/json Authorization: Basic api_key ``` #### Response Payload ```json [image/png] ``` For more information on retrieving sender information, see [Managing Senders](/v1/docs/sharepoint-managing-senders#java-sdk). ### Extracting a Specific Signature Image The following code will do this: #### HTTP Request ```http GET /api/packages/{packageId}/roles/{roleId}/signatureImage ``` `GET /api/packages/{packageId}/roles/{roleId}/signatureImage` #### HTTP Headers ```http Accept: image/png,image/jpeg,image/gif Content-Type: application/json Authorization: Basic api_key ``` #### Response Payload ```json [image/png] ``` In this case, you will need the package id and role id of the signer. ## APEX SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/extract-signature-image-apex-sdk/) site. You can extract the signature image for any Sender in your account. When doing so, note the following: - The default signature image size is 350 x 100 pixels. - If the sender does not exist or the sender does not have a captured signature, an error.notFound.userNotFound exception will be thrown. - If the image type is invalid or not supported, an error.validation.signatureImageType exception will be thrown. - Images can be in PNG, JPEG, or GIF format. - This procedure will only work for signatures of the CAPTURE type. ### Extracting Signature Images To extract a sender's signature as an image file, use the following encapsulated function to pass the sender ID to download the signature. ```plaintext     //Get Signature Image For Sender     String senderId = 'ATQOPd60xE4V';     Blob signatureImageForSender = getSignatureImageForSender(senderId); ``` Then, open a new file to write the data to a destination of your choice. For more information on retrieving sender information, see [Managing Senders](/v1/docs/sharepoint-managing-senders#java-sdk). ```plaintext //store blob        Document signatureImageForSenderDocument = new Document();        signatureImageForSenderDocument.Body = signatureImageForSender;        signatureImageForSenderDocument.FolderId = folder.id;        signatureImageForSenderDocument.Name = 'Signature image for sender: '+ senderId +' - ' + Datetime.now().format();        signatureImageForSenderDocument.Type = 'jpg';        documents.add(signatureImageForSenderDocument); ``` ### Extracting a Specific Signature Image To download a specific signer’s captured signature from a specific transaction, use the following encapsulated cuntion to pass the package id, signer id. ```plaintext        String packageId = 'E-cmEaSbHjLDNf631aj3Y8-hvCk=';        String roleId = 'Signer2';        Blob signatureImageForPackageRole = getSignatureImageForPackageRole(packageId,roleId); ```