ImageCompressorOptions constructor
const
ImageCompressorOptions({
- required int targetSizeInKB,
- int initialQuality = 92,
- int minQuality = 40,
- int step = 4,
- int? maxWidth,
- int? maxHeight,
- CompressFormat format = CompressFormat.jpeg,
- bool keepExif = false,
- double earlyStopRatio = 0.95,
- double nearTargetFactor = 1.2,
- int preferredMinQuality = 80,
- int maxAttemptsPerDim = 5,
- int maxTotalTrials = 24,
Implementation
const ImageCompressorOptions({
required this.targetSizeInKB,
this.initialQuality = 92,
this.minQuality = 40,
this.step = 4,
this.maxWidth,
this.maxHeight,
this.format = CompressFormat.jpeg,
this.keepExif = false,
this.earlyStopRatio = 0.95,
this.nearTargetFactor = 1.2,
this.preferredMinQuality = 80,
this.maxAttemptsPerDim = 5,
this.maxTotalTrials = 24,
}) : assert(targetSizeInKB > 0),
assert(initialQuality <= 100 && initialQuality > 0),
assert(minQuality > 0 && minQuality <= initialQuality),
assert(step > 0),
assert(earlyStopRatio > 0 && earlyStopRatio <= 1.0),
assert(nearTargetFactor >= 1.0),
assert(preferredMinQuality > 0 && preferredMinQuality <= 100),
assert(maxAttemptsPerDim > 0),
assert(maxTotalTrials > 0);