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:
- Enabling Media Conversion: https://help.sap.com/viewer/403d43bf9c564f5a985913d1fbfbf8d7/v2011/en- US/fba094343e624aae8f041d0170046355.html
- mediaconversion Extension: https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2011/en- US/8c0fe559866910149d53fdd269604a83.html
- ImageMagick Configuration: https://help.sap.com/docs/SAP_COMMERCE/d0224eca81e249cb821f2cdf45a82ace/8bedccfd866910149ccbb7fbabcf2349.html
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
- The original media/image is actually compressed with a different format instead of its extension tells
- Media conversion fails when adding parameters like {addon#1} in conversion command
- Converted media are grayscale or lower quality -upgraded from 7.0.11-14 to 7.1.0-35
- How to Add Watermark on Images on CCV2
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.