Media Conversion in SAP Hybris

Hey friends ! This blog post covers the concept of Media Conversion using a third-party tool which can be integrated to Hybris for conversion of Medias.

We might go through cases, where we need several media formats for the same image, like image of dimensions 1200Wx1200H and same image with different dimensions like a 515×515 or 96×96 or any other as per our requirement.

Hybris allows third party open source software suite for converting the Medias to required formats. Here we are going to see how the third party tool ‘ImageMagick’ can be used within Hybris for Media Conversion.

1) Download and Install ImageMagick 

First you need to install the ImageMagick , for downloading go to https://www.imagemagick.org. Download the software as per your OS configurations.

Install the software in your system.

You can now see it installed in the corresponding drive.


2) Configure the ImageMagick path in Hybris system

Configure below 2 properties in local.properties file.

imagemagick.bindir

imagemagick.configuration.directory

3. Media conversion in HMC

Below are the action items that are needed for Conversion of a media in required formats.

a. Create source media.
b. Create conversion formats.
c. Create conversion group.
d. Create media container and assign the media and conversion group.

a) Create media

You can create a media by following our previous blog (https://blogs.sap.com/2016/11/30/media-creation-in-sap-hybrisdigital-asset-management/ )

Here I have created a media Test_Media_Convert having media format 1200×1200 as shown below.

b) Create Media Conversion Formats.

Now this is the main step, here you define your own media format(for example resizing the medias to particular format).

Go to Multimedia->Media Format->Create->Conversion Media Format.

Provide a unique qualifier name, and other details as shown below.

Conversion Strategy: Here the Conversion Strategy will be populated by default initially. As we are using the same ImageMagick, we shall keep this same.

Conversion Command: We need to provide the commands as per the format is required.

In below image, I am creating a format of 300×300, hence I provide the command as -resize 300×300. This is the command syntax for ImageMagick.

For more commands check here https://www.imagemagick.org/script/command-line-processing.php

Click on Create and then Save.

I have created one more Media Conversion Format for 96×96.

c) Creating Conversion Group

Conversion Group is just to group the required Media conversion formats. Follow below steps to create one.

Provide the details.

Add the created Conversion Media Formats in step b) in Supported Formats area as shown below.

Click on Create and Save.

d) Creating Media Container and assigning Media and Conversion Group

Provide the required details and the Media created in step a.

Click on the Search icon for adding the Conversion Group that was created in step c.

Search for the conversion group, select it and click on Use button.

You can see the Conversion Group (Test_Conversion_Group) is assigned. Click on Create and then Save.

Initially before saving, the button Convert missing medias was disabled.

Now after saving you can see, the button is enabled.

Click on ‘Convert missing medias’ button.

By doing this, the conversion group that has the conversion media formats are executed and the commands are triggered.

Below pop-up would come.

Click on Close Window.

Now you can see, 2 more medias are created of sizes 300×300 and 96×96.

These are the converted medias per the ImageMagick commands given in Conversion formats.

So that was the Media Conversion concept with example. Hope this was helpful.

Thanks for reading ! Will be back with another concept in next blog.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !
Comments (0)
Add Comment