LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Convert text to image? (https://www.linuxquestions.org/questions/linux-software-2/convert-text-to-image-716659/)

J_Szucs 04-03-2009 03:55 PM

Convert text to image?
 
I would like to convert a lot of text to jpeg images.

I tried it from the command line using convert:
echo "This is some text to test if imagemagick is useable for converting text to image" | convert -page 500x360+0+0 -font Helvetica -style Normal -background none -undercolor white -fill black -pointsize 22 text:- +repage -background white -flatten text_box_trimmed.png

I supposed that the above command would wrap long text lines, but it did not. Long lines were truncated, instead.

I also tried it manually, by first converting the text to pdf by OpenOffice, then converting pdf to jpg by imagemagick.

This was also prevented by convert: it inserted a large blank area above the text, when converting it to jpeg. It seemed as if convert did not like the landscape-oriented pdf page, so it made a square-like image of it by inserting the blank area.

Is there a way to efficiently convert text to jpeg at the present immature stage of softwares on linux?

Edit:
Finally I succeded with the "inferior" method through pdf (using the -trim option to remoe the blank area). But the quality of the text on the resulting image is really bad this way. It just cannot be compared to the method when the conversion is made from text directly.

i92guboj 04-03-2009 06:49 PM

I've never done this, but if the whole problem with imagemagick is that it doesn't wrap lines, you can do that previously with an external tool, can't you?

thorkelljarl 04-03-2009 07:03 PM

A guess...

Doesn't OpenOffice Draw allow saving documents as jpeg? You might have to go by way of Writer, if you could get the text composed there in the form you want.

dth1 04-04-2009 11:34 AM

The way I do this is to type the text using koffice, then use ksnapshop to picture the screen and then edit the jpg. Not a very neat way but it works.

arizonagroovejet 04-04-2009 02:22 PM

Quote:

Originally Posted by i92guboj (Post 3497817)
I've never done this, but if the whole problem with imagemagick is that it doesn't wrap lines, you can do that previously with an external tool, can't you?

The fold command comes to mind.

Code:

echo "blah blah blah" | fold -w a_number
As ever, 'man fold' for more info.

John VV 04-04-2009 02:48 PM

i would just have OO save the text as a pdf then open that pdf in gimp and save that as a *.jpg ( i would use png , but that is just me )


All times are GMT -5. The time now is 04:00 PM.