THPDFImageRecompressionCostInfo Record
Telemetry of a visual-cost image recompression pass: scanned and candidate counts, per-codec outcomes, trial and rejection counters, quality and error aggregates and byte savings
Declaration
THPDFImageRecompressionCostInfo= record
ScannedImageCount: Integer;
CandidateImageCount: Integer;
RecompressedImageCount: Integer;
RecompressedJPEGCount: Integer;
RecompressedJPEG2000Count: Integer;
EncodingTrialCount: Integer;
VisualErrorRejectionCount: Integer;
ByteCostRejectionCount: Integer;
SelectedQualitySum: Integer;
MaximumSelectedPerceptualError: Double;
BytesBefore: Int64;
BytesAfter: Int64;
BytesSaved: Int64;
DeterministicSelection: boolean;
end;
Unit
HPDFDoc
Fields
| Field | Purpose |
|---|---|
ScannedImageCount | Images inspected by the pass |
CandidateImageCount | Images that entered the quality search once eligibility checks had passed |
RecompressedImageCount | Images that were actually re-encoded and written back |
RecompressedJPEGCount | Re-encoded images whose final filter is JPEG |
RecompressedJPEG2000Count | Re-encoded images whose final filter is JPEG 2000 |
EncodingTrialCount | Trial encodings performed whilst sweeping the quality range |
VisualErrorRejectionCount | Trials rejected because the perceptual error went over the budget |
ByteCostRejectionCount | Trials rejected because the byte-cost weight swamped the score |
SelectedQualitySum | Sum of the qualities chosen per recompressed image, for averaging |
MaximumSelectedPerceptualError | Highest perceptual error across the accepted recompressions |
BytesBefore / BytesAfter | Image stream bytes taken before and after the pass |
BytesSaved | Byte difference achieved; compare against the options' minimum-savings threshold |
DeterministicSelection | true when every reported choice arose from the deterministic cost comparison |
Usage notes
- Filled by
THotPDF.OptimizeLoadedImagesByVisualCost; the function result is the number of images recompressed and the record carries the complete accounting - Divide
SelectedQualitySumbyRecompressedImageCountto obtain the average chosen quality - Read
BytesBefore,BytesAfterandBytesSavedafter the call to confirm the pass met the configured savings goal