Max size Timage

Please discuss general Delphi programming topics here.

Max size Timage

Postby HPW » April 29th, 2006, 1:43 pm

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?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 236
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » April 29th, 2006, 6:03 pm

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;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » April 29th, 2006, 6:10 pm

It's not Delphi's limit, it's the Windows' one.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Postby HPW » April 29th, 2006, 8:50 pm

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?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 236
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » April 29th, 2006, 11:27 pm

Bitmaps in Delphi are not in compressed format. Maybe bitmaps for example in RLE format doesn't have such a problem.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2430
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 4 guests

cron