How to convert a bufferedImage to Dam Asset | Community
Skip to main content
Level 2
October 16, 2015
Solved

How to convert a bufferedImage to Dam Asset

  • October 16, 2015
  • 1 reply
  • 1083 views

Hi ,

I have an image object in the form of java.awt.image.BufferedImage .

 BufferedImage image = ImageIO.read(filepath);

I want  to create a Dam asset using this object.

Please sugget ways in which this can be done.

 

Thank you in advance

Harish

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 JustinEd3

Hi Harish,

Did you look at the createAsset method of AssetManager? See http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/dam/api/AssetManager.html#createAsset(java.lang.String, java.io.InputStream, java.lang.String, boolean)

This accepts an InputStream. There's no need to parse the image file into a BufferedImage. If you had generated a BufferedImage through some other means (say, by generating one from scratch), you can use the ImageIO API to generate a byte array from the BufferedImage and then pipe that into an InputStream.

1 reply

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi Harish,

Did you look at the createAsset method of AssetManager? See http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/dam/api/AssetManager.html#createAsset(java.lang.String, java.io.InputStream, java.lang.String, boolean)

This accepts an InputStream. There's no need to parse the image file into a BufferedImage. If you had generated a BufferedImage through some other means (say, by generating one from scratch), you can use the ImageIO API to generate a byte array from the BufferedImage and then pipe that into an InputStream.