AEM Assets: Extend parameter scaling issues when using pixel values
This article explains how to achieve expected asset scaling results in Adobe Experience Manager Assets when using the extend parameter with pixel and percentage values.
Description description
Environment
Adobe Experience Manager (AEM) Assets (all versions)
Issue/Symptoms
When adjusting assets using the Width, Height, and Extend parameters, using pixel values for the extend parameter don’t produce the expected increase in asset dimensions. In some cases, the adjustment works, but in others, the results were inconsistent. The issue is reproducible by following the steps:
- Using pixel values for extend applies the extension to the original image dimensions, not the scaled-down version.
- Using percentage values for extend produces more predictable results.
No specific error messages are shown, but the output asset dimensions don’t match expectations based on the documented Open API specification.
Cause
The extend parameter with pixel values is applied to the original asset dimensions before scaling, leading to unexpected results. Using percentage values aligns the extension with the scaled asset size, producing predictable outcomes.
Resolution resolution
Follow the steps below to resolve the issue:
- Review the asset adjustment requirements and confirm whether the extend parameter should be applied before or after scaling with width and height.
- If using pixel values for extend, note that the extension is applied to the original asset dimensions, not the scaled-down version. This results in unexpected output sizes.
- To achieve predictable scaling, use percentage values for the extend parameter. Calculate the required percentage based on the difference between the desired output size and the scaled asset size:
Example calculation for width: (desired_width - scaled_width) / scaled_width / 2 = percentage
Apply the calculated percentage to both sides in the extend parameter.
4. Update asset adjustment URLs to use percentage values for extend. For example:
https://delivery-p133069-e1367924.adobeaemcloud.com/adobe/assets/urn:aaid:aem:604edaf1-bc6a-43c7-8997-f13333beb158/as/Creatividad_Santander.jpg?height=179&background-color=rgb,ff0000&extend=45.5p,0,45.5p,0&auto-format=false
- Test the asset adjustment and verify that the output matches the expected dimensions.