Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Convert Text To Graphic

668 views
Skip to first unread message

mahmou...@my-deja.com

unread,
May 29, 1999, 3:00:00 AM5/29/99
to
Dear friends How can I save the Text of a memo (and/or) the picture of the
hole Form (and/or) Canvas to a JPG file . Regards Mahmoud


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Daniel Berg (Berg Soft)

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
Draw your text onto the canvas of a bitmap and use a JPG-Component to
save it

Daniel BErg

--
----------------------------------------
Daniel Berg (Berg Soft)

be...@bergsoft.de
http://www.bergsoft.de
---------------------------------------

Jens Hofmann

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
On Sat, 29 May 1999 16:21:02 GMT, mahmou...@my-deja.com wrote:

>Dear friends How can I save the Text of a memo (and/or) the picture of the
>hole Form (and/or) Canvas to a JPG file . Regards Mahmoud

Hello,

to save the whole formimage as a jpeg you have to add the "JPEG"-Unit
to your uses. And then do the following :

var
Jpeg : TJpegImage;
begin
JPeg := TJpegImage.Create;
jpeg.Assign(getformimage);
jpeg.SaveToFile('c:\bild.jpg');
jpeg.free;
end;

So far...


Ci@o Jens


Michael Koenig

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
On Sat, 29 May 1999 16:21:02 GMT, mahmou...@my-deja.com wrote:

Hi Mahmoud,

>Dear friends How can I save the Text of a memo (and/or) the picture of the
>hole Form (and/or) Canvas to a JPG file . Regards Mahmoud

1. First you have to get a component which can save a bitmap to a file
in the JPG-format. You can look at the Delphi Super Page, or if you
have a professional version of Delphi or better, you should already
have one (TJPEGImage).

2. Regarding to the JPEG component you are using, assign it directly
or indirectly a canvas. For example, if you want to copy a whole form
canvas to a TJPEG-image, i would try following steps:

a) Creating a TBitmap object and assigning it the canvas of the form.
b) Creating a TJPEGImage object and assigning it the Bitmap.

3. To save a text to a canvas, look in the online help under the topic
TCanvas and TextOut (or so).

Bye, Michael

Robert Rossmair

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
mahmou...@my-deja.com wrote:

> Dear friends How can I save the Text of a memo (and/or) the picture of the
> hole Form (and/or) Canvas to a JPG file . Regards Mahmoud

Hi,

why JPEG? I don't think that's a good choice if your image contains only
few colors. To save the text of a memo, a monochrome bitmap
(PixelFormat = pf1bit, 2 colors) would be appropriate.

Example code, not tested:

var
ScrollBars: TScrollStyle;
begin
...
ScrollBars := Form1.Memo1.ScrollBars;
Form1.Memo1.ScrollBars := ssNone; { make ScrollBars invisible, if
there are any }
try
with TBitmap.Create do
try
PixelFormat := pf1bit;
Width := Form1.Memo1.ClientWidth;
Height := Form1.Memo1.ClientHeight;
Canvas.CopyRect(Rect(0, 0, Width, Height), Form1.Canvas, Rect(
Form1.Memo1.Left,
Form1.Memo1.Top,
Form1.Memo1.Left+Width,
Form1.Memo1.Top+Height));
SaveToFile('Memo1.bmp');
finally
Free;
end;
finally
Form1.Memo1.ScrollBars := ScrollBars;
end;

I just did a bit experimenting: a text page, 620 x 405 pixel, captured
using PaintShop Pro and saved as a .JPG (good quality), resulted in a
file of 104.5 kB. A monochrome bitmap of this size would occupy only
30.7 kB. Shrinking the JPEG file to the same size would result in
something hardly readable, I guess.

For screenshots in general, GIF is a better suited graphics format than
JPEG as long as there are no photo-type graphics visible on the screen.
I recommend the GIFImage library (freeware) by Anders Melander
(http://www.melander.dk, if my memory serves me well).

(But I've heard the GIF format copyright owners let you really bleed if
you want to use it for commercial purposes.)

Greetings, Robert
--
Robert Roßmair
http://home.t-online.de/home/Robert.Rossmair/
____________________________________________
Real Programmers never work 9 to 5. If any real programmers
are around at 9 AM, it's because they were up all night.


0 new messages