trichview.com

trichview.support




Re: How to paste bitmap without bigsize #2


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/01/2005 21:13:56


> Dear Sergei

>

> I have tried the your png proposal but the blob size still very big.


It's strange - it converts all bitmaps to png, and should be highly reduced

in size.

Of course, it depends on images themselves - if they are like screenshots,

they should become very small, if they are photos or paintings, it's may be

better to use jpeg.

May be documents are big because they contain unnecessary styles? Make sure

that AutoDeleteUnusedStyles property is set to True.


Your code is overcomplicated a bit. And it does not set DoDefault = False,

so the editor inserts bitmap after you inserted jpeg.


procedure TFrmNotes.RichPaste(Sender: TCustomRichViewEdit;

  var DoDefault: Boolean);

var

V: Integer;

  JPEG: TJPEGImage;

  Bitmap: TBitmap;

begin

  If Sender.CanPasteRVF or Sender.CanPasteRTF then

    exit;

  If Clipboard.HasFormat(CF_BITMAP) then

  Begin

    Bitmap := TBitmap.Create;

    try

      Bitmap.Assign(Clipboard);

      JPEG := TJPEGImage.Create;

      JPEG.Assign(Bitmap);

      Sender.InsertPicture('',JPEG,rvvaBaseLine);

      DoDefault := False;

    finally

      Bitmap.Free;

    end;

  End;

end;


In the code above, JPEG can be changed to PNG, and TJPEGImage to TPngObject.





Powered by ABC Amber Outlook Express Converter