Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
PeterPanino
Posted - Dec 07 2023 : 05:17:15 I could append an SVG file to the database using the FireDAC database TIEDBMultiBitmap Demo in Delphi 12 and by adding Vcl-Skia to the uses list. However, the SVG looks blurry in the TImageEnMView and very small in the TImageEnView:
How can I show the SVG image in this demo without quality loss?
7 L A T E S T R E P L I E S (Newest First)
xequte
Posted - Dec 14 2023 : 19:27:41 Hi
Please email me for the latest beta. When TIEDBMultiBitmap stores images in blobs it will now load the image content directly (if ImageFormat is not specified).
var
fs: TFileStream;
begin
fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
try
fs.Position := 0;
// Transfer from the memory stream to the blobstream
aBlobStream := BlobField.DataSet.CreateBlobStream( BlobField, bmWrite );
try
aBlobStream.CopyFrom( fs, fs.Size );
finally
aBlobStream.Free;
end;
finally
fs.free;
end;
It would be nice if you could integrate this into your Database demo project. SVG is quickly becoming a central topic in Delphi.
xequte
Posted - Dec 07 2023 : 16:07:55 Note: If you do want to load the image into the database as a raster format, you can set its size as follows:
var
bmp: TIEBitmap;
begin
bmp := TIEBitmap.Create;
try
bmp.ParamsEnabled := True;
bmp.Params.LoadToWidth := 1000;
bmp.Params.LoadToHeight := 1000;
bmp.Params.AutoScaleImport := True;
bmp.Read('input.svg');
... Do something with bmp...
finally
bmp.Free;
end;
end;
You don't want ImageEn to convert the file at all when it is inserted into the table, so just use regular database methods to insert the SVG file into the table, something like:
var
fs: TFileStream;
begin
fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
try
fs.Position := 0;
// Transfer from the memory stream to the blobstream
aBlobStream := BlobField.DataSet.CreateBlobStream( BlobField, bmWrite );
try
aBlobStream.CopyFrom( fs, fs.Size );
finally
aBlobStream.Free;
end;
finally
fs.free;
end;
Posted - Dec 07 2023 : 07:32:41 Specifying an explicit size, unfortunately, does not work with SVG:
fDBMultiBitmap.AppendImage( 512,512, ie24RGB );
PeterPanino
Posted - Dec 07 2023 : 07:16:13 The loss of quality is apparently due to converting the SVG file into a raster image when inserting it into the database. Is it possible to influence this conversion so that a raster image of a specific minimum size is always generated?