Sitecore Content Hub: How to Set Hidden Media Processing Parameters Not Exposed in the UI

Hello everyone, welcome to another blogpost.

Sitecore Content Hub lets you configure media processing flows from the UI, but not every parameter of a processing task shows up there. Two useful ones on the Convert image task are missing from the form: jpegcompression and keepbackgroundtransparency.

In this post I'll show how to set these hidden parameters by exporting the media processing configuration, editing it and importing it back. That way they're applied every time media processing runs.

The two parameters

Parameter Type What it does
jpegcompression Integer JPEG quality level of the output rendition. A higher value gives better quality and a bigger file.
keepbackgroundtransparency Boolean Keeps the existing transparency in the output, including when converting PDF to PNG.

When would you need them?

  • Your JPG renditions (for example the preview or a web-ready rendition) look too compressed, or they're bigger than your channels need.
  • Transparent PNGs, or PDFs converted to PNG, come out with a white or black background when you need it transparent.

Both parameters are listed in Sitecore's Conversion matrix structure documentation.

The problem

Open Manage > Media processing, pick a set (for example Images) and open a Convert image task. The Parameters tab shows width, height, target extension, color space and so on, but there's no field for jpegcompression or keepbackgroundtransparency.

The solution: export, update, import

Content Hub's Import/Export feature can package the media processing configuration as JSON. You edit the task in that JSON, import the package back, and then refresh renditions.

⚠️ Before you start: Try this on a non-production environment first, and keep the original export as a backup. Sitecore's documentation notes that it doesn't support issues caused by manual changes to export packages, so you need to be able to roll back.

Step 1: Export the media processing configuration

  1. On the menu bar, click Manage.
  2. Click Import/Export.
  3. In the Export section, select only Media processing.
  4. Start the export and download the ZIP package when it's ready.

Step 2: Find the Convert image task

  1. Extract the ZIP and open the media processing folder.
  2. Open the JSON file (M.MediaMatrix.Content.json) for the set you want to change, for example Images.
  3. Search for the Convert image task that creates the rendition you're targeting, such as preview or a custom web rendition. Its targetextension and output values help you pick the right one.

Step 3: Add or update the parameters

Add the two properties next to the task's other parameters, or change their values if they're already there. Here's an example for a Thumbnail:

"type": "convert_image",
"input": "...",
"output": "...",
"targetextension": "jpg",
"width": 1200,
"height": 1200,
"jpegcompression": 90,
"keepbackgroundtransparency": false

And for a PNG rendition where transparency must be kept:

"targetextension": "png",
"keepbackgroundtransparency": true

Tips:

  • Leave the existing keys and structure as they are and only add or change these two properties. Use the exact key names and casing your exported file already uses.
  • Run the file through a JSON validator before you zip it again. A missing comma will make the import fail.

Step 4: Import the package back

  1. Zip the package again with the same folder structure as the export (the root of the ZIP must match the original).
  2. Go to Manage > Import/Export, choose the import option and upload the ZIP.
  3. Wait for the import job to finish and confirm it succeeded.
  4. Open Manage > Media processing and check the set. If it shows unpublished changes, click Publish.

Step 5: Refresh renditions

New uploads pick up the change automatically. Existing assets don't, because automatic reprocessing is off by default, so you have to refresh their renditions:

  1. On the menu bar, click Assets.
  2. Select the assets you want to reprocess.
  3. Click Actions > Refresh renditions.
  4. Turn off Failed only so all renditions are regenerated, not just the failed ones, and then confirm.

Step 6: Verify the result

  • JPEG compression: Download the JPG rendition and compare its file size and quality with the earlier version.
  • Transparency: Open the PNG rendition on a dark or checkered background to confirm it's still transparent.

Wrapping up

The UI shows only part of what a processing task can do. If you know the conversion matrix and use Import/Export, you can set parameters like jpegcompression and keepbackgroundtransparency that the UI doesn't expose. A good habit is to keep the edited package in source control, so you can apply the same change to your other environments.

References

Thanks for reading and keep learning.

You can check my other blogs too if interested. Blog Website

Comments

Popular posts from this blog

Switching Docker Desktop to Docker CLI in Easy Way

My Sitecore Upgrade Learnings Part 1

Steps to Generate Access Token for Authoring API Endpoint in XM Cloud