Convert text to raster image

Convert text to raster image

Anonymous
Not applicable
2,069 Views
2 Replies
Message 1 of 3

Convert text to raster image

Anonymous
Not applicable

I need to convert an AcDbText o Mtext entity to a raster image that is as large as the text.

What can I use?

Raster printer in Autocad doesn't allow me to add custom image size while printing and is really slow on exixting formats.

 

Thanks

 

Flavio

0 Likes
2,070 Views
2 Replies
Replies (2)
Message 2 of 3

nick83
Advocate
Advocate

1. so, custom paper size doesn't work because of too small size? am i right (that's one of the limitations i told)

 

2. are you sure that you want "raster image that is as large as the text" and the task is correct?

autocad's font can be too small of too big (it's a vector object). so, your picture can be 10000000000000x10000000000000 or 1x1 pixel 🙂

as a sample (bitmap 1x1 pixel. font size is 0.25):

text.jpg

 

PS: actually, you can use printing to jpg, and then cut the part of it (you can get width and height of your text and position of your text on jpg, you know width and height of the jpg.)

PS2: but if you want your text was always readable, it's better to create it manually. you can get text string, color(s), angle... from an autocad object and then create canvas and write this text on it with all needed parameters and save it to file

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hi Nick, thanks for your reply.

Adding custom paper size doesn't work because the raster printer to create JPG 

is a pc3 file and not actually a physical printer, so the open printer method returns false.

 

Even if I print on standard raster format (VGA) the process is really slow due to spool and background work of autocad.

 

I've chosen the way of create a new jpeg file using a .NET graphic object with the drawstring method on a bitmap object.

It seems to work for the quality of the text but I'm facing some problems with pixel offset and padding.

I'll let you know the final solution

 

Thanks

Flavio

0 Likes