The wiki entry for PascalMagick suggests a unit
magicklcl with procedures for loading a file or a stream of images into a TBitmap.
https://wiki.freepascal.org/PascalMagick#Procedures_to_load_images_to_a_Lazarus_TBitmap_with_ImageMagickThis unit is referenced as being proposed in this message thread ...
https://forum.lazarus.freepascal.org/index.php/topic,20016.msg114885.html#msg114885The original posting was dealing with "Reading black & white TIFF images?"
I have tried following that in a simple project as suggested loading into a Timage.Picture.bitmap
However while the image loads with no errors, it is degraded appearing as bands of white and a lilac like colour.
The procedure I use was set to save the opened image to disk so it might be reviewed here.
I attach a reduced copy of the original jpeg (so it can fit in as a Forum attachment) and the output filename suffixed = with _rendered.
The output (Ive shrunk and produced as a PNG to preserve detail) does not look at all correct, in fact it seems to be monochrome in a lilac type colour,
and I remembered that the original procedure had been sparked in a discussion dealing with monochrome tiffs.
What modifications should I make please, I can not see where to go with this at present.
Here is my simple routine relying on the Unit described and linked to above.
procedure TForm1.opgetTrialImageClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
magicklcl.LoadMagickBitmap(OpenDialog1.FileName, testImage.Picture.Bitmap);
testImage.Picture.SaveToFile(ExtractFileName(OpenDialog1.FileName)+'_rendered.jpg', 'jpg');
end;
end;
I also tried this totally in memory. That output filename is suffixed _rendered_virtually
procedure TForm1.openVirtualIMageClick(Sender: TObject);
var
thisPicture : TPicture;
begin
if OpenDialog1.Execute then
begin
thisPicture := TPicture.Create;
try
magicklcl.LoadMagickBitmap(OpenDialog1.FileName, thisPicture.Bitmap);
thisPicture.SaveToFile(ExtractFileName(OpenDialog1.FileName)+'_rendered_virtually.jpg', 'jpg');
finally
thisPicture.Free;
end;
end;
end;
Both output images look the same. slightly posturized and monochrome.
Any advice appreciated please.
What am I missing, no doubt something very simple, here?
As I say, I've attached the output images here, but I had to shrink and process two of them to PNGs, and a smaller version of original jpeg, to fit them in a Forum posting, but the resultant problem can be clearly seen.
Paul