Enum Class JpegSubsampling

java.lang.Object
java.lang.Enum<JpegSubsampling>
cloud.opencode.base.image.codec.jpeg.JpegSubsampling
All Implemented Interfaces:
Serializable, Comparable<JpegSubsampling>, Constable

public enum JpegSubsampling extends Enum<JpegSubsampling>
JPEG chroma subsampling mode (mirrors libjpeg-turbo TJSAMP_*). JPEG 色度下采样模式(对应 libjpeg-turbo 的 TJSAMP_*)。

Defines how much chroma (color) information is preserved relative to the luma (brightness) channel during JPEG encoding. Lower subsampling preserves more color detail at the cost of larger file size.

定义 JPEG 编码时色度(颜色)信息相对亮度通道的保留比例。较低的下采样比保留更多 颜色细节,但文件体积更大。

Security | 安全性:

  • Thread-safe: Yes - immutable enum. - 线程安全: 是 - 不可变枚举。
  • Bounds-checked: fromNative(int) rejects unknown native values. - 边界检查: fromNative(int) 拒绝未知 native 值。
Since:
JDK 25, opencode-base-image-codec V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • S_444

      public static final JpegSubsampling S_444
      4:4:4 (no chroma subsampling, highest quality). | 4:4:4(无色度下采样,最高质量)。
    • S_422

      public static final JpegSubsampling S_422
      4:2:2 (horizontal halving). | 4:2:2(水平半采样)。
    • S_420

      public static final JpegSubsampling S_420
      4:2:0 (horizontal + vertical halving, default). | 4:2:0(水平+垂直半采样,默认)。
    • S_GRAY

      public static final JpegSubsampling S_GRAY
      Grayscale. | 灰度。
    • S_440

      public static final JpegSubsampling S_440
      4:4:0 (vertical halving). | 4:4:0(垂直半采样)。
    • S_411

      public static final JpegSubsampling S_411
      4:1:1 (horizontal quartering). | 4:1:1(水平四分采样)。
  • Method Details

    • values

      public static JpegSubsampling[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JpegSubsampling valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • nativeValue

      public int nativeValue()
      Returns the native TJSAMP_* integer for this subsampling mode. 返回该模式对应的 native TJSAMP_* 整数值。
      Returns:
      native value passed to libjpeg-turbo | 传递给 libjpeg-turbo 的 native 值
    • fromNative

      public static JpegSubsampling fromNative(int nativeValue)
      Maps a native TJSAMP_* integer back to a JpegSubsampling. 将 native TJSAMP_* 整数映射回 JpegSubsampling
      Parameters:
      nativeValue - native value from libjpeg-turbo | libjpeg-turbo 返回的 native 值
      Returns:
      corresponding enum constant | 对应的枚举常量
      Throws:
      IllegalArgumentException - if nativeValue is unknown | 当 nativeValue 未知时抛出