в общем итоговая процедура получилась у меня вот так, при этом заработало там где до этого не работало
procedure CheckAndLoadFromStream(FileName:string; const ABitmap : TBitmap);
var
MaxImageSize : Integer;
ABitmapSurface,ABitmapSurfaceResize : TBitmapSurface;
mxH,mxW:integer;
begin
ABitmapSurface:=TBitmapSurface.Create;
ABitmapSurfaceResize:=TBitmapSurface.Create;
TBitmapCodecManager.LoadFromFile(FileName,ABitmapSurface);
MaxImageSize:=TCanvasManager.DefaultCanvas.GetAttribute(TCanvasAttribute.MaxBitmapSize);
if (ABitmapSurface.Height>MaxImageSize) or (ABitmapSurface.Width>MaxImageSize) then
begin
if ABitmapSurface.Height>ABitmapSurface.Width then
begin
mxH:=MaxImageSize;
mxW:=Round(mxH/ABitmapSurface.Height*ABitmapSurface.Height);
end else
begin
mxW:=MaxImageSize;
mxH:=Round(mxW/ABitmapSurface.Width*ABitmapSurface.Height);
end;
end else
begin
mxW:=ABitmapSurface.Width;
mxH:=ABitmapSurface.Height;
end;
ABitmapSurfaceResize.SetSize(mxW,mxH);
ABitmapSurfaceResize.StretchFrom(ABitmapSurface,mxW,mxH);
FreeAndNil(ABitmapSurface);
ABitmap.SetSize(mxW,mxH);
ABitmap.Assign(ABitmapSurfaceResize);
FreeAndNil(ABitmapSurfaceResize);
end;