Thanks molly.
I am trying to port a function, without success, that works on Delphi.
I have changed the Delphi unit JPeg to Lazarus unit Graphics, and
uses ...
Graphics,
LCLType, // HBitmap type
IntfGraphics, // TLazIntfImage type
fpImage, // TFPColor type
FPReadJpeg, FPWriteJpeg; // jpg support
procedure LoadImageFromField(Image: TImage; ImageField: TBlobField);
var
MemStrm: TMemoryStream;
Jpg: TJPEGImage;
begin
if ImageField.IsNull then
begin
Image.Picture.Assign(nil);
Exit;
end; //if
Jpg := TJPEGImage.Create;
try
MemStrm := TMemoryStream.Create;
try
ImageField.SaveToStream(MemStrm);
MemStrm.Seek(0,soFromBeginning);
with Jpg do begin
PixelFormat := jf24Bit;
Scale := jsFullSize;
Grayscale := False;
Performance := jpBestQuality;
ProgressiveDisplay := True;
ProgressiveEncoding := True;
LoadFromStream(MemStrm);
end; //with
Image.Picture.Assign(Jpg)
finally
MemStrm.Free;
end; //try
finally
Jpg.Free;
end; // fim try finally
end;
But I am still receiving errors on some properties e values:
Compile Project, Target: TestImages.exe: Exit code 1, Errors: 7, Hints: 1
BasicRoutines.pas(433,26) Error: Identifier not found "jf24Bit"
BasicRoutines.pas(434,11) Error: Identifier not found "Scale"
BasicRoutines.pas(435,21) Error: No member is provided to access property
BasicRoutines.pas(437,11) Error: Identifier not found "ProgressiveDisplay"
BasicRoutines.pas(438,31) Error: No member is provided to access property
Can you help find the right units that seems to miss?