Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

for products on white backgrounds - dynamically crop white space out of product without cropping image subject

Avatar

Level 1

We have product images on white backgrounds, we want to remove the white background by cropping to the image subject without cropping off any of the image subject, this currently happens with Smart Crop. We are using Dynamic Media with AEM Assets.

6 Replies

Avatar

Level 8

Hi @eezanke 

 

You can try to use this modifier to make the background transparent . Please append the same to the existing url and try "&fmt=webp-alpha"

 

https://experienceleague.adobe.com/en/docs/dynamic-media-developer-resources/image-serving-api/image...

 

 

Avatar

Level 1

Not the question really...I want to crop to the image subject, i.e. a chair that has a white background...so that the crop results in the edges of the image touching the edges of the chair...like this one below:

 

eezanke_0-1716394833437.png

Eric

Avatar

Level 8

@eezanke 

You can use the Knockout Background feature in Dynamic Media instead of Smart Crop. The Knockout Background feature automatically detects and removes the background color from an image during upload to AEM Assets. It analyzes the image corners to determine the background color, then makes that color transparent while keeping the subject intact
 

The below article about "Image fine-tuning options at upload" might help

https://experienceleague.adobe.com/en/docs/dynamic-media-classic/using/master-files/image-editing-op...

 

Try and let us know if this works

Avatar

Level 9

Hi @eezanke ,

To dynamically crop white space out of product images without cropping the image subject, you can use the "Trim" feature in Dynamic Media with AEM Assets. The Trim feature automatically removes any whitespace around the edges of an image, while preserving the image subject.

Here's how you can use the Trim feature in Dynamic Media:

1. Open the Dynamic Media Image Preset Editor in AEM Assets.
2. Select the "Trim" option under the "Crop" section.
3. Set the "Trim Color" to "White" to remove white space around the edges of the image.
4. Save the Image Preset.

When you apply this Image Preset to your product images, Dynamic Media will automatically crop out any white space around the edges of the image, while preserving the image subject.

Note that the Trim feature works best when the white space around the image is consistent and uniform. If there are variations in the white space around the image, the Trim feature may not work as expected. In such cases, you may need to use other image processing techniques, such as manual cropping or Smart Crop, to achieve the desired result.

Avatar

Level 1

Ok...where is Dynamic Media Image Preset Editor in AEM Assets...is it in the tools menu?...not seeing it in the below

eezanke_0-1716486290590.png

 

 

Avatar

Administrator

@eezanke Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni