• I save mail-merged documents to a database and I have just noticed the large size of these documents. These are documents with JPG images but when they are saved the size of them goes from approx 20k to 1.5mb.

    Why is this?

    Ken

  • Julian,

    Thanks. Basically I am doing the following to embed an image. It is a jpg 245 wide by 145 or so h using the following code:

    lStream:=TMemoryStream.Create;
    TBlobField(Query.FieldByName('Thumbnail')).SaveToStream(lStream);
    lStream.Position:=0;
    Img:=TWPOImage.Create(WP2);
    Img.FileExtension:='JPG';
    Img.LoadFromStream(lStream);
    lStream.Free;
    Img.WidthTW:=Img.ContentsWidth div 2;
    Img.HeightTW:=Img.ContentsHeight div 2;
    Obj:=Cell.AppendNewObject(wpobjImage,false,false,0);
    Obj.ObjRef:=Img;

    Then I store the document in a database using:

    Letter.TextSaveFormat:='RTF-nomergefields';
    lStream:=TMemoryStream.Create;
    Letter.SaveToStream(lStream);
    lStream.Position:=0;
    TBlobField(Tbl.FieldByName('Letter')).LoadFromStream(lStream);
    lStream.Free;

    The WriteObjectMode property is wobRTF .

    I will send the resultant RTF file to support.

    Ken

    • Offizieller Beitrag

    Hi,

    Thanks for the file - I see that your image is embedded -as it should- as original image.

    When you open the RTF file in any editor You will find

    {\pict\jpegblip\picw3675\pich2460\picwgoal3675\pichgoal2460
    \bin1692989 Ï Ó JFIF H H ß hExif II* 8 SONY DSC H H DSLR-A200 v1.00 C h u r c h M i c e C o t t a g e SONY DSLR-A200

    Which is the embedded original JPEG data.

    If you need smaller image files You need to embed a smaller copy of the image - scale it down first.

    Julian

  • Julian,

    Thanks. Turned out to be my mistake. I wasn't clearing a TMemoryStream before assigning to it so it was putting the small image at the end of where a large image was already.

    Thanks for your help.

    Ken