Migration Guide: cropPadding Behavior Change (v56.0)
This guide helps you migrate from the old cropPadding behavior (inward contraction) to the new behavior (outward expansion) introduced in version 56.0.0.
Do You Need to Migrate?
Check your JSON configurations for cropPadding properties:
-
If you’re not using
cropPadding, or usingcropPadding: {"x": 0, "y": 0}→ No migration needed -
If you’re using positive
cropPaddingvalues → Read carefully below (behavior has changed) -
If you’re using negative
cropPaddingvalues → Action required — negative values now cause a runtime exception and must be converted to positive values
Understanding the Change
|
The Previous behavior (Android only): Positive New behavior (Android and iOS): Positive |
Example with positive values:
{
"width": 700,
"cropPadding": {"x": 50, "y": 50}
}
-
Before (v55.x): Captured image would be 600×600px (contracted inward)
-
After (v56.0): Captured image will be 800×800px (expanded outward)
|
Negative Example — before (v55.x):
Example — after (v56.0+):
|
Migration Options
Convert to Positive Values (Required if Using Negative cropPadding)
Replace any negative cropPadding values with their positive equivalents. Positive values now expand the captured region outward, which is the recommended behavior for improved scan accuracy at document edges.
Accept Improved Behavior (Recommended for Positive cropPadding Users)
The new outward expansion provides better scan accuracy and is more forgiving of user positioning errors. Simply test your scanning workflows to verify the improved results meet your requirements.
Benefits:
-
Better scan accuracy at document edges
-
More forgiving document positioning
-
Slight misalignments are now captured within the padded region
-
Aligns with iOS behavior and industry standards
Testing Recommendations
-
Test your scanning workflows with existing configurations
-
Verify captured image dimensions meet your requirements
-
Check that OCR/processing results remain accurate
-
Adjust
cropPaddingvalues if needed for your specific use case
Technical Details
Formula (in camera resolution pixels):
cropWidth = cutoutWidth + 2 * cropPadding.x
cropHeight = cutoutHeight + 2 * cropPadding.y
cropX = cutoutX - cropPadding.x + cropOffset.x
cropY = cutoutY - cropPadding.y + cropOffset.y
Note: All values are in camera resolution pixels (px), not density-independent pixels (dp).
|
Get help
If there is anything you are missing, you require support, or want to provide us with feedback, please reach out to us via https://support.anyline.com, where you either may find helpful information in our Knowledge Base or you can open a Support Ticket for more specific inquiries. In order to better assist you, please include any code of your Anyline integration and any ScanViewConfig you are using. |