trichview.com

trichview.support




Re: Auto-Convert Bitmap to JPG-Image


Return to index


Author

Message

Michael Beck

Posted: 08/09/2002 6:39:32


"Michael Beck" <none> wrote in message news:[email protected]...


> Anyone with an example for it?


OK, based on some stuff I found on Internet, that's what I came with:


procedure TForm3.RichViewEdit1Paste(Sender: TCustomRichViewEdit; var

DoDefault: Boolean);

var

  BMPImg: TBitmap;

  jpgImg: TJPEGImage;

begin

  if Clipboard.HasFormat(CF_BITMAP) then

    begin

      jpgImg := TJPEGImage.Create;

      BMPImg := TBitmap.Create;

      try

        BMPImg.LoadFromClipboardFormat(cf_BitMap,

ClipBoard.GetAsHandle(cf_Bitmap), 0);

        jpgImg.assign(BMPImg);

        jpgImg.Compress;

        RichViewEdit1.InsertPicture('', jpgImg, rvvaBaseline);

      finally // wrap up

        BMPImg.Free;

      end; // try/finally

    end;

  DoDefault := False;

end;


which doesn't get sized correctly when pasted - the picture's height get

smaller, while the frame of the picture remains correct.


Assuming that we could get this right,  how could I make it work for all

pictures contained in the document that paste, i.e. if I select a word

document in Word, and paste it into RichView, it would automatically convert

all pictures to JPEG (or GIF for that matter)?


Thanks,


Michael





Powered by ABC Amber Outlook Express Converter