THPDFImageRecompressionCostOptions Record
Tunes the visual-cost image recompression search: quality range and step, perceptual error budget, visual and byte-cost weights, minimum savings and sampling stride
Declaration
THPDFImageRecompressionCostOptions= record
MinimumQuality: Integer;
MaximumQuality: Integer;
QualityStep: Integer;
MaximumPerceptualError: Double;
VisualErrorWeight: Double;
ByteCostWeight: Double;
MinimumSavingsBytes: Int64;
SampleStride: Integer;
class function Default: THPDFImageRecompressionCostOptions; static;
end;
Unit
HPDFDoc
Fields
| Field | Purpose |
|---|---|
MinimumQuality | Lower bound of the swept quality range; by default 30 |
MaximumQuality | Upper bound of the swept quality range; by default 90 |
QualityStep | Increment between trial qualities; by default 10 |
MaximumPerceptualError | Perceptual error a candidate must not exceed to be accepted; by default 3.0 |
VisualErrorWeight | Weight of the perceptual-error term in the cost score; by default 1.0 |
ByteCostWeight | Weight of the byte-cost term in the cost score; by default 1.0 |
MinimumSavingsBytes | Minimum byte saving required before a recompression is kept; by default 1 |
SampleStride | Pixel stride used when sampling decoded images for the error measurement; by default 4 |
Default | Class function handing back the values listed above |
Usage notes
- Start from
THPDFImageRecompressionCostOptions.Defaultand adjust single fields; a largerQualitySteptrades accuracy against fewer encoding trials - Raise
ByteCostWeightto push the search towards smaller files, orVisualErrorWeightto favour fidelity - Pass the record to
THotPDF.OptimizeLoadedImagesByVisualCostand read the matchingTHPDFImageRecompressionCostInfofor the full outcome accounting