The Layer class from AEM is very useful for doing image manipulation in AEM. It is also used in the Adobe Core WCM Components and wcm.io Media Handler for image processing.

When testing AEM application code with AEM Mocks, the Layer class can be used as well. Out-of-the-box the following file formats are supported:

  • JPEG
  • PNG
  • GIF

If you need support for additional file formats in your unit tests, you have to add Java ImageIO plugins to your test classpath. A good source for such plugins is TwelveMonkeys ImageIO.

TIFF

For adding support for TIFF images add to your POM:

<dependency>
  <groupId>com.twelvemonkeys.imageio</groupId>
  <artifactId>imageio-tiff</artifactId>
  <version>3.7.0</version>
  <scope>test</scope>
</dependency>

SVG

For adding support for SVG vector images add to your POM:

<dependency>
  <groupId>com.twelvemonkeys.imageio</groupId>
  <artifactId>imageio-batik</artifactId>
  <version>3.7.0</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.apache.xmlgraphics</groupId>
  <artifactId>batik-transcoder</artifactId>
  <version>1.9.1</version>
  <scope>test</scope>
</dependency>

Back to top

Version: 5.6.3-SNAPSHOT. Last Published: 2024-09-16.