Images lose color | Rendering with Layer Class

Issue

Some colors are missing in every GIF rendered through the Layer Class.

Solution

The second argument of the write method defines the image quality:

  • JPEG: The compression quality is a number between 0.0 -> 1.0. Usually, the value 0.8 is a good compromise between quality and image file size.
  • GIF: The number of colors is between 1 and 256.

Therefore, the correct code is as follows:

layer.write(imageBean.getImageType() , 256, cqResponse.getOutputStream());

Additional information

This issue occurs when the number of colors is set to eight instead of 256, in the Layer.write() method:

layer.write(imageBean.getImageType() , 8, cqResponse.getOutputStream());

 Adobe

更快、更輕鬆地獲得協助

新的使用者?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

10 月 14 至 16 日邁阿密海灘和線上

Adobe MAX 2024

Adobe MAX

The Creativity Conference

10 月 14 至 16 日邁阿密海灘和線上