Getting custom rendition programatically | Community
Skip to main content
Adobe Champion
March 8, 2023
Solved

Getting custom rendition programatically

  • March 8, 2023
  • 1 reply
  • 984 views

I have a custom rendition created for jpeg image in AEM and programmatically I am trying to get that rendition as a stream.

I can see this rendition exist in the image node, but when I try to get it as input steam , I get null pointer exception.

 

final Asset asset = DamUtil.resolveToAsset(resource);
InputStream in = asset.getRendition("cq5dam.web.300.300.jpeg").getStream();

 

Same code works for png rendition.

final Asset asset = DamUtil.resolveToAsset(resource);
InputStream in = asset.getRendition("cq5dam.thumbnail.319.319.png").getStream();

 

Anyone know why is the difference and why it is failing for jpeg image?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by thatsmeadarsh

Please check if that particular rendition is available for that asset by checking via crxde.

 

1 reply

thatsmeadarsh
thatsmeadarshAccepted solution
Level 3
March 9, 2023

Please check if that particular rendition is available for that asset by checking via crxde.

 

P_V_NairAdobe ChampionAuthor
Adobe Champion
March 9, 2023

One of the images in the result didn't have the rendition. Thanks @thatsmeadarsh