CCv2 Image Processing


Introduction

Media Conversion is an important step as part of the CCv2 checklist. This blog explains the various image processing options for solution architects and developers who want to migrate to CCv2. With Cloud Automation from SAP, an image conversion service is available in the SAP Commerce cloud.

Let’s look into the various options for image processing.

ImageMagick

Most of us have already used ImageMagick with SAP Commerce (hybris) project. Let’s see how CCv1 or standard on-Prem projects have used ImageMagick.

CCv1/On-Prem Solution:

  • Images are picked up from the file system and processed by Custom Media Import jobs such as ProductMediaImportJobs.
  • Once MediaConversionService is invoked, ImageMagickConversionStrategy component is used to convert the actual image using the local ImageMagick installation.

After migrating to CCv2, you would still want to use ImageMagick. So let’s see what possible changes we might need:

  • Use Azue CloudBlob storage instead of File Objects
  • Use cloudmediaconversion extension
  • Update manifest.json file to use image processing service (enableImageProcessingService)

CCv2 Solution:

  • Read the image files from Azure Blob Storage using CloudBlob objects
  • MediaConversionService is used to call conversion Strategy called RemoteImageMagickMediaStrategy (cloudmediaconversion extension)
  • RemoteImageMagickMediaStrategy call the image conversion web service
  • WebService Calls the ImageMagick commands to convert the images automatically when the configuration property (enableImageProcessingService) on CCv2 is shown below in manifest.json. 

Helpful Links:

Java 2D

This was the solution used when CCv2 was introduced and ImageMagick was not supported by SAP.

I will not go into details about this implementation since SAP recommends using ImageMagick as its OOTB in CCv2 now, however, it is good to know that mediacontrib extension was built using Java Image scaling library – “imgscalr-lib-4.2.jar” .

DAM Integration

This solution can reduce a lot of manual tasks of image conversion logic. There are different ways that one could integrate with the DAM (Digital Asset Management) system to receive the right Asset URLs. Most of the DAM systems can be integrated using simple REST API calls.

  • Get the Asset ID using PIM (product information management) integration
  • Once you have the URLs from the DAM system, you need to do the following
    • create media Model for each asset
    • create  mediaContainer Model
    • attach the mediaContainer to Product
  • Solr update
    • Update SolrIndexedProperty with the right value provider bean name of type abstractImageValueProvider to index on PLP and SRP Pages

[SOLVED]: Issues

That’s all for now on Image Processing on SAP Commerce.

Hope this has helped you to speed up your CCv2 migration. Stay tuned for more solutions. 🙂

If you have any feedback or suggestions, please feel free to add a comment below.