Ad Code

Tuesday, February 28, 2017

Image Rendition with Cropping in AEM 6.2



"DAM Update Asset" is a default workflow which is triggered whenever any asset is uploaded into the DAM. This workflow helps to limit the size and the quality of the image displayed.

Why Image Renditions are required:
  1. Using different size images on the websites.
  2. Images for different devices or viewPort.
  3. Reducing the page load time.

Existing Workflow Scenario:

Steps to create Custom Rendition:
  • Go to the "DAM update asset" workflow
  • Select "Process Thumbnails" Step.
workflow.PNG
Fig-  Select and edit the Process Thumbnail Step

  • Add custom renditions as per your requirements
Fig - Add the Size of Rendition in Thumbnail Multifield

Cropping:

In the existing “DAM Update Asset” workflow image renditions are getting generated for different resolutions by resizing the images, but here cropping for the assets is not happening. However the need was to crop the image uniformly(top, bottom, left, right).
To achieve this, follow below steps:
  • Add Custom process(Rendition Image Cropping) step after “Process Thumbnail”.
  • Edit the Rendition Image Cropping process step.
  • Select the Process Tab.
  • Add the WorkFlow Process (Image Rendition Cropping Workflow Process).
custom.JPG
Fig- Add the New  Process Step and Select the
Custom Image Rendition Workflow process in the Process Tab

  • In the Process tab Configure the rendition size in Arguments field.
workflowImg.PNG
Fig- Configure The rendition size in the Arguments Section

Arguments: The custom workflow takes the arguments as input, fetch the original image size and crop the image from top, bottom, left and right.
Example: Let’s suppose the original size of image is "2200*1200" and the required image size is "640*360" .
  • Reduce the image from left and right equally ( 780px) to make the width as 640.
  • Reduce the image from top and bottom equally ( 420px) to make the height as 320.
example.jpg
Fig- Sample Image showing the cropping concept

Check the below code for Image Rendition Process:

You can see all the renditions like this:

crx.PNG
Fig - Renditions Created Under Dam Hierarchy

Demo Video:

        

You can install the package directly from here.
find the Git Repository

Mail us at sgaem.blog02@gmail.comg for any query or suggestion.

Hope it will help you guys !!👍
Thanks and Happy Learning 😊

5 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi, This is very useful. IS it possible to put up an article for core image component and how to achieve smart adaptive images with sample implementation. Right now I am facing issues in getting the image widths on page load

    ReplyDelete
  3. When i am selecting image from the image component then how to resize the image in AEM 6.3??

    ReplyDelete