| ImageEn, unit iexHelperFunctions |
|
IEEstimateImageQuality
Declaration
function IEEstimateImageQuality(const FileName: WideString): Integer; overload;
function IEEstimateImageQuality(Stream: TStream; ImageType: TIOFileType): Integer; overload;
Description
Estimates the quality that was used for saving a JPEG HEIF/HEIC, AVIF or WebP file.
The returned value can then be used for the
ImageQuality property (to maintain a similar quality level).
Result will be -1 if an error is encountered, e.g. for an image that is not available or not a supported format.
Note:
◼For JPEG, it uses the (highly accurate)
IECalcJpegFileQuality
◼For other formats it performs a calcutation based on the bits per pixel. Results will not be particularly accurate, and one of: 30, 50, 65, 75, 85, 90, 95, 100
ImageEnView1.LoadFromFile( 'C:\input.heic' );
// do image processing here...
ImageEnView1.IO.Params.ImageQuality := IEEstimateImageQuality('C:\input.heic');
ImageEnView1.IO.SaveToFile('D:\output.heic');