CompressConfig class

Configuration for an image compression operation.

Example:

const config = CompressConfig(
  quality: 80,
  maxWidth: 1920,
  maxHeight: 1080,
  outputFormat: CompressFormat.jpeg,
);

Constructors

CompressConfig({int quality = 85, int? maxWidth, int? maxHeight, CompressFormat? outputFormat, int rotate = 0, bool autoCorrectOrientation = true, CompressInterpolation interpolation = CompressInterpolation.linear, bool keepExif = false})
const

Properties

autoCorrectOrientation bool
When true (default), reads the EXIF orientation tag and rotates the image to its canonical upright orientation before applying any other transforms. The orientation tag is then stripped.
final
hashCode int
The hash code for this object.
no setterinherited
interpolation CompressInterpolation
Interpolation algorithm used when resizing. Default: CompressInterpolation.linear.
final
keepExif bool
When true, preserves EXIF metadata in the output (JPEG only). The orientation tag is always stripped regardless of this flag. Default: false.
final
maxHeight int?
Maximum output height in pixels. See maxWidth for details.
final
maxWidth int?
Maximum output width in pixels. The image will be scaled down proportionally if its width exceeds this value.
final
outputFormat CompressFormat?
The output image format. When null, the format is inferred from the input image (WebP inputs fall back to JPEG).
final
quality int
Output quality from 0 (worst) to 100 (best). Default: 85.
final
rotate int
Clockwise rotation in degrees. Must be 0, 90, 180, or 270. Applied after EXIF orientation correction. Default: 0.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({int? quality, int? maxWidth, int? maxHeight, CompressFormat? outputFormat, int? rotate, bool? autoCorrectOrientation, CompressInterpolation? interpolation, bool? keepExif}) CompressConfig
Returns a copy of this config with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited