ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Problem with TImageEnIO.Bitmap after update from Version9 to 12

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Speedy_08 Posted - Jun 12 2023 : 08:21:59
Hello,

I have updated from version 9 to 12. Unfortunately, after the update, my code no longer works as desired.

i my case i paint some things to a bitmap and try to save it in 2 different formats.
Unfortunately, when save,
i get the message that there is no valid image in the function CheckHaveValidBitmap.
With Version 9.x ist runs without problems.
OK, i create and use only an TBitmap instead of an IEBitmap.
How can i handle this in version 12?


my Code:

var
 myBMP: TImageENIO;
begin
 try
  myBMP := TImageENIO.Create(self);
  myBMP.Bitmap := TBitmap.Create;
  myBMP.Bitmap.PixelFormat := pf8bit;
  myBMP.Params.JPEG_Quality := 100;
  myBMP.Bitmap.Height := 500;
  myBMP.Bitmap.Width := 500;
  PaintLines(myBMP.Bitmap);
//Crash with Error "Bitmap not valid"
  myBMP.SaveToFileJPEG(Temp_Path + Pict_Filenames + '.jpg');
  myBMP.SaveToFilePNG(Temp_Path + Pict_Filenames + '.png');
  myBMP.Bitmap.Free;
  FreeAndNil(myBMP);
end;

1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 12 2023 : 12:37:24
Hi

Please use AttachedBitmap (or CreateFromBitmap) rather than setting the Bitmap property:

http://www.imageen.com/help/TImageEnIO.AttachedBitmap.html
http://www.imageen.com/help/TImageEnIO.CreateFromBitmap.html

var
  myBMP: TBitmap;
  myIO: TImageEnIO;
begin
  myBMP := TBitmap.Create;
  myBMP.PixelFormat := pf8bit;
  myBMP.Height := 500;
  myBMP.Width := 500;
  PaintLines(myBMP);

  myIO := TImageEnIO.CreateFromBitmap( myBMP );
  myIO.Params.JPEG_Quality := 100;
  myIO.SaveToFileJPEG(Temp_Path + Pict_Filenames + '.jpg');
  myIO.SaveToFilePNG(Temp_Path + Pict_Filenames + '.png');
  FreeAndNil(myIO);  

  myBitmap.Free;
end;


Nigel
Xequte Software
www.imageen.com