Home > Back-end >  DELPHI read image files
DELPHI read image files

Time:09-18

Who is a great god with Delphi read picture tutorial, want to read the JPG, in the form of binary DICOM images such as
Anyone know where I can download TDICOMX controls,

CodePudding user response:

 
The function LoadImage (var Image: TImage; The DataSet: TDataSet; ImgFieldName: String) : Boolean;
Var f: TField;
Stream: TMemoryStream;
JPG: TJpegImage;
The begin
Result:=False;
Image. The Picture. The Assign (nil);
If not a DataSet. The Active then the exit;
If the DataSet. RecordCount<1 then the exit;

F:=DataSet. FindField (ImgFieldName);
If f=nil then exit;
If not f.I sBlob then exit;
If f.I sNull then exit;

Stream:=TMemoryStream. Create; Try
TBlobField (f). SaveToStream (stream);
JPG:=TJpegImage. Create; Try
Stream. Position:=0;
Try
JPG. LoadFromStream (stream);
Image. The Picture. The Assign (JPG);
Result:=True;
Except,
MessageBox (0, PChar (' not JPG image data of the field holds: '# 13 # 10 + ImgFieldName),' mistakes', MB_OK or MB_ICONSTOP);
end;
The finally
JPG. Free;
end;
The finally
Stream. Free;
end;
end;
  • Related