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 using cropPadding: {"x": 0, "y": 0}No migration needed

  • If you’re using positive cropPadding values → Read carefully below (behavior has changed)

  • If you’re using negative cropPadding values → Action required — negative values now cause a runtime exception and must be converted to positive values

Understanding the Change

The cropPadding property now expands the captured region outward beyond the visible cutout, matching iOS behavior and industry standard expectations for "padding".

Previous behavior (Android only): Positive cropPadding values contracted the crop area inward, reducing the captured region size.

New behavior (Android and iOS): Positive cropPadding values expand the crop area outward, increasing the captured region size for better edge accuracy.

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 cropPadding values are no longer valid. Providing negative values will cause a runtime exception at SDK initialization. You must convert any negative values to their positive equivalents.

Example — before (v55.x):

{
  "cropPadding": {"x": -50, "y": -50}
}

Example — after (v56.0+):

{
  "cropPadding": {"x": 50, "y": 50}
}

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.

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

  1. Test your scanning workflows with existing configurations

  2. Verify captured image dimensions meet your requirements

  3. Check that OCR/processing results remain accurate

  4. Adjust cropPadding values 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.