Supported Formats
Input Formats
- iOS
- Android
SashaSDK accepts image input through CIImage
, which generally supports:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- HEIF/HEIC (.heic, .heif)
- TIFF (.tiff, .tif)
- BMP (.bmp)
There are a lot of convenience ways of getting a CIImage
representation of your usual data types:
CIImage.init?(image: UIImage)
- for common assets representation;CIImage.init?(contentsOf: URL)
- for locally stored images;CIImage.init(cgImage: CGImage)
- for more advanced usage of image manipulation;CIImage.init?(data: Data)
- for those advanced cases where your image has raw data rerepresentation;
The SDK accepts an ImageSource object for all processing operations. ImageSource can be created from the following sources:
ImageSource.Uri(context, uri)
: From anandroid.net.Uri
.
The underlying image decoding supports:
- JPEG
- PNG
- HEIF
- WEBP
For consistent processing, all images are converted to an sRGB color space internally. For more details about image decoding: https://developer.android.com/reference/android/graphics/ImageDecoder
Image Specifications
Property | Requirement |
---|---|
Maximum Width | 2000px (auto-scaled if bigger) |
Minimum Size | 500x500px |
Output Format
- iOS
- Android
The SDK returns the output SashaSDK.Signing.Output
object for processed image.
extension SashaSDK.Signing {
struct Output: Sendable {
/// Global unique identifier of the embedded `SASHA` data.
public let signatureId: SignatureID
/// Image representation containing the `SASHA` signature embedded.
public let processedImage: CIImage
/// - Parameters:
/// - signatureId: Global unique identifier of the embedded signature.
/// - processedImage: image with the signature embedded.
init(signatureId: SignatureID, processedImage: CIImage) {
self.signatureId = signatureId
self.processedImage = processedImage
}
}
}
The SDK returns the output EmbeddedSignature object for processed images. This contains data (image) and signatureId
data class EmbeddedSignature(
val data: PixelBufferData,
val signatureId: ULong
)
PixelBufferData contains the following properties:
data class PixelBufferData(
val width: Int,
val height: Int,
val format: Int, // Using android.graphics.PixelFormat constants
val colorSpace: ColorSpace,
val pixelBuffer: ByteBuffer,
val rowBytes: Int
)
This can be easily converted to a bitmap using the extension functions toBitmap() available in the PixelBufferData class.
val embeddedSignature = EmbeddedSignature() // Embedded signature from SDK
embeddedSignature.data.toBitmap()?.let { bitmap ->
// output image in bitmap
}