Page 1 of 1

How to save an image from RVE to file?

Posted: Tue Aug 12, 2008 3:30 am
by Marsianin
I didn't find any answers to this question (may be because search function for this forum is ugly).

How can I save an image from TRichViewEdit to a file? Also I need to know what format it has (BMP, PNG, JPG, GIF) if it's important for saving.

Posted: Wed Aug 13, 2008 6:36 pm
by Sergey Tkachenko
Do you want to draw the content of TRichView on the picture (and then save it to file)?
See the demo in Demos\Delphi\Assorted\Graphics\ToImage\

Posted: Wed Aug 13, 2008 7:23 pm
by Marsianin
No. If current object is TGraphics I want to save it to disk. Just one attached picture.
And I need to know first what format it has (PNG, GIF, JPG, BMP) to save it in appropriate format.
Like export to HTML does.

Posted: Thu Aug 14, 2008 5:01 am
by Sergey Tkachenko
You can get the graphic object at the position of caret using GetCurrentPictureInfo method, and save using gr.SaveToFile.
The problem is in finding the proper file extension.
This extension is returned by the function GraphicExtension:
ext := GraphicExtension(TGraphicClass(gr.ClassType));
This function works only for graphic classes with registered file extensions.
They can be registered using TPicture.RegisterFileFormat procedure. They are already registered for standard graphic classes.

Posted: Thu Aug 14, 2008 8:44 am
by Marsianin
Ya, it works :D