Webp images path not shoing in graphql | Community
Skip to main content
Level 2
May 13, 2025

Webp images path not shoing in graphql

  • May 13, 2025
  • 2 replies
  • 698 views

I have used webp images in content fragments. When I create a graphql query to get images path. The json is coming blank for those images. where as JPEG images path are showing perfectly fine. Do I need to enable webp in AEM as cloud to get images path or it is not supported in graphql

Please advice

 

2 replies

SantoshSai
Community Advisor
Community Advisor
May 13, 2025

Hi @harsharya,

I don't think, WebP images are not fully supported out-of-the-box in GraphQL queries due to missing renditions and missing metadata extraction support for that format. The JSON will return empty if:

  • AEM doesn't generate metadata for WebP,

  • The Asset lacks width/height or dynamic media info,

  • The GraphQL model can't resolve any of the required fields.

You can try this:

Enable WebP Processing in AEM

Ensure AEM is set to process WebP assets:

  1. Enable WebP in Asset Compute service (Cloud Service only):

    • By default, WebP is not processed the same way as JPEG/PNG.

    • You need to use custom Asset Compute workers or enable support via Adobe support.

  2. Verify WebP metadata in Asset UI:

    • Go to your WebP asset in DAM.

    • Check if metadata like width, height, and renditions are generated.

    • If not — that’s why GraphQL returns empty.

Use JPEG/PNG for GraphQL-Based Delivery

As a workaround, consider storing fallback versions in JPEG/PNG if GraphQL delivery is important. You can still serve WebP via Dynamic Media or client-side rendering techniques later.

Use renditions (if applicable)

In some cases, if you need to retrieve a rendition path of the WebP manually, and it’s generated by your own workflow, you could add that logic to your GraphQL model. However, this needs custom modeling, and is not automatic.

How to Check if WebP Is Supported

Run this AEM GraphQL query for a CF containing a WebP asset:

{
  yourContentFragmentModelList {
    items {
      images {
        ... on ImageRef {
          _path
          title
          width
          height
          _dynamicUrl
        }
      }
    }
  }
}

If all fields return null, AEM did not process the WebP file.

Hope that helps!

Santosh Sai
giuseppebaglio
Level 10
May 14, 2025

hi @harsharya,

I think you can leverage the _assetTransform parameter: documentation

You can update the query like so:

_dynamicUrl title _assetTransform(format: WEBP, preferWebp: true)

In the response, the field _dynamicUrl should include the URL in WebP format.

HarsharyaAuthor
Level 2
May 14, 2025

@giuseppebaglio 

_assetTransform does not work with image ref. 

I have already tried this option in my query still its not showing image urls. In addition after applying asset transform on query it changes all the jpg url to webp which is not the requirement.

 

 

Supriya_Savre
Level 4
May 20, 2025

Hi @harsharya,

Do you need more information or assistance regarding your query? If yes, please feel free to share a follow up query.

If you've discovered a solution yourself, we would appreciate it if you could share it with the community.