Hi
Please use this updated version of IEResampleImageFile:
function IEResampleImageFile(const sInFilename, sOutFilename: string;
JpegQuality: Integer;
MaxX, MaxY: Integer;
StretchSmall: Boolean = False;
QualityFilter: TResampleFilter = rfLanczos3;
AutoAdjustOrientation: Boolean = False;
bStripMetaData: Boolean = False
): Boolean;
var
ABitmap: TIEBitmap;
io: TImageEnIO;
ASize: TPoint;
begin
result := true;
ShowTempHourglass();
try
ABitmap := TIEBitmap.create();
io := TImageEnIO.CreateFromBitmap(ABitmap);
try
io.Params.GetMetaData := not bStripMetaData;
// Load full size for best quality (and avoid size discrepency if we are auto-rotating)
if io.LoadFromFileEx(sInFilename, -1, -1, AutoAdjustOrientation) = False then
raise EIEException.create( IEExceptionMsg( ieexReadError ));
if StretchSmall or (ABitmap.width > MaxX) or (ABitmap.height > MaxY) then
begin
// Resize the image
ASize := GetImageSizeWithinArea(ABitmap.Width, ABitmap.Height, MaxX, MaxY);
ABitmap.Resample(ASize.X, ASize.Y, QualityFilter);
end;
if bStripMetaData then
io.Params.ResetInfo();
if not io.SaveToFileEx(sOutFilename, JpegQuality) then
raise EIEException.create( IEExceptionMsg( ieexWriteError ));
finally
io.Free;
ABitmap.Free;
end;
except
result := false;
end;
end;
Nigel
Xequte Software
www.imageen.com