Hi Peter
In your code you create a bitmap but you never fill it with anything, so you get an invalid bitmap error.
Try something like (untested):
if ImageEnProc1.CanPasteFromClipboard then
begin
ImageEnProc1.PasteFromClipboard();
var IO := TImageEnIO.CreateFromBitmap( ImageEnProc1.AttachedIEBitmap );
try
IO.Params.PNG_TextKeys.Add('Author');
IO.Params.PNG_TextValues.Add('Peter');
IO.SaveToFilePNG(AFilename);
finally
IO.Free;
end;
end;
Though it would be easier with a TImageEnView:
Try something like (untested):
var iev := TImageEnView.Create( nil);
try
if iev.Proc.CanPasteFromClipboard then
begin
iev.Proc.PasteFromClipboard();
iev.IO.Params.PNG_TextKeys.Add('Author');
iev.IO.Params.PNG_TextValues.Add('Peter');
iev.IO.SaveToFilePNG(AFilename);
end;
finally
iev .Free;
end;
Nigel
Xequte Software
www.imageen.com