ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 SVG in database demo

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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:

attach/PeterPanino/202312751523_DBMultiBitmapFD.zip
622.11 KB

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).

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Dec 08 2023 : 11:29:18
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;


Nigel
Xequte Software
www.imageen.com
xequte Posted - Dec 07 2023 : 15:55:39
Hi Peter

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;


Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Dec 07 2023 : 07:55:40
Even when using this Append overload, the same small raster image is produced:


    var bm := TIEBitmap.Create;
    try
      bm.Width := 512;
      bm.Height := 512;
      bm.Read(dlgOpenImage.Filename);
      fDBMultiBitmap.AppendImage( bm );
    finally
      bm.Free;
    end;
PeterPanino 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?