Page 1 of 1

Max size Timage

PostPosted: April 29th, 2006, 1:43 pm
by HPW
I get in trouble with one of my other plugins using a Timage.
When I try to work with big images I get 'EOutOfResources' - Not enough storage is available.

I reproduce it with simple demo-app:

Code: Select all
procedure TForm1.FormCreate(Sender: TObject);

var
  Bitmap: TBitmap; { Temporäre Variable für das Bitmap }
begin
  Bitmap := TBitmap.Create; { Das Bitmap-Objekt erstellen }
 Bitmap.Width := 2048; { Anfangsbreite... }
 Bitmap.Height := 10958; { ...und Anfangshöhe zuweisen }
 Image1.Picture.Graphic := Bitmap; { Das Bitmap dem Bild-Steuerelement zuweisen }
end;


With value a bit higher than 10958 it crashes.
Is there a limit with delphi?

PostPosted: April 29th, 2006, 6:03 pm
by Kambiz
You didn't release the bitmap object.

Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
  Bitmap: TBitmap; { Temporäre Variable für das Bitmap }
begin
  Bitmap := TBitmap.Create; { Das Bitmap-Objekt erstellen }
  try
    Bitmap.Width := 2048; { Anfangsbreite... }
    Bitmap.Height := 10958; { ...und Anfangshöhe zuweisen }
    Image1.Picture.Graphic := Bitmap; { Das Bitmap dem Bild-Steuerelement zuweisen }
  finally
    Bitmap.Free;  // This line is missed in your code
  end;
end;

PostPosted: April 29th, 2006, 6:10 pm
by Kambiz
It's not Delphi's limit, it's the Windows' one.

PostPosted: April 29th, 2006, 8:50 pm
by HPW
Yes, I throw the sample together to show the size problem.

>It's not Delphi's limit, it's the Windows' one.

A Windows' one? I wonder how other professional imaging application then handle such sizes?

PostPosted: April 29th, 2006, 11:27 pm
by Kambiz
Bitmaps in Delphi are not in compressed format. Maybe bitmaps for example in RLE format doesn't have such a problem.