Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

16-bit png renditions

Avatar

Level 1

Hi,

 

I'm sure this is an easy one, but I can't see for looking.

 

In AEM Assets, when I upload a 16-bit png, I need the renditions it generates to also be 16-bit png. Currently, I can only get the system to generate 8-bit png's, so Im losing the alpha channel.

 

Any pointers will be much appreciated

Cheers

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

hi @DamionD-321 ,

You can create a custom workflow model to handle the generation of 16-bit PNG renditions. Here's an alternative approach:

  1. Access the AEM Workflow Console:

    • Log in to your AEM author instance.
    • Navigate to Tools -> Workflow -> Models.
    • Click on the "Create" button to create a new workflow model.
  2. Define the workflow model:

    • Give the workflow model a suitable title and name.
    • Add the "Thumbnail Process" step to the workflow model. This step is responsible for generating renditions.
    • Configure the "Thumbnail Process" step to generate the desired rendition sizes and formats.
  3. Add a custom process step:

    • Add a custom process step after the "Thumbnail Process" step.
    • Configure the custom process step to execute a script that modifies the rendition options.

    Here's an example script that sets the rendition options for 16-bit PNG:

 

// Create custom rendition options
var renditionOptions = {
    mime: "image/png",
    quality: 1.0,
    bitDepth: 16
};

// Get the asset object
var asset = workflowData.getPayload();

// Update the rendition options for all renditions
asset.addRenditionOptions(renditionOptions);

 

4. Save and activate the workflow model.


This custom workflow model will generate 16-bit PNG renditions for your assets. You can initiate this workflow manually or configure it to run automatically when assets are uploaded or modified.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

hi @DamionD-321 ,

You can create a custom workflow model to handle the generation of 16-bit PNG renditions. Here's an alternative approach:

  1. Access the AEM Workflow Console:

    • Log in to your AEM author instance.
    • Navigate to Tools -> Workflow -> Models.
    • Click on the "Create" button to create a new workflow model.
  2. Define the workflow model:

    • Give the workflow model a suitable title and name.
    • Add the "Thumbnail Process" step to the workflow model. This step is responsible for generating renditions.
    • Configure the "Thumbnail Process" step to generate the desired rendition sizes and formats.
  3. Add a custom process step:

    • Add a custom process step after the "Thumbnail Process" step.
    • Configure the custom process step to execute a script that modifies the rendition options.

    Here's an example script that sets the rendition options for 16-bit PNG:

 

// Create custom rendition options
var renditionOptions = {
    mime: "image/png",
    quality: 1.0,
    bitDepth: 16
};

// Get the asset object
var asset = workflowData.getPayload();

// Update the rendition options for all renditions
asset.addRenditionOptions(renditionOptions);

 

4. Save and activate the workflow model.


This custom workflow model will generate 16-bit PNG renditions for your assets. You can initiate this workflow manually or configure it to run automatically when assets are uploaded or modified.

Avatar

Level 1

Amazing, thank you so much.

I'll give this a go

 

Cheers

Damion