Vertical Spacing issue

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
applejax

Vertical Spacing issue

Post by applejax »

Hi, I sent this to the Help desk b/c I don't know if it's a bug or not. I have this text file that says something like:

Test
on multiple
lines.


But when the image gets produced it looks like there are extra return lines in there like this:

Test

on multiple

lines.


My command isn't anything complicated so what's up with the vertical spacing? How do you correct this? The commands I used:

convert -pointsize 72 -density 196 txt:test.txt -resample 72 -trim +repage -bordercolor white -border 3 done.png

Note: Changing the font size doesn't do anything either.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Vertical Spacing issue

Post by anthony »

More than likely your text is a windows text file. that is the end of every line contains a NEWLINE and a RETURN
character. If you can remove one of those characters from the input file. You may also want to remove BOTH characters at the end of the file so that an exta blank line is not generated.

Under UNIX / Linux, or even MacOSX, this is not really a problem as these systems has lots of tools to manipulate text files as a standard part of the system. Things like, "tr", "sed", "perl", etc, etc and may have other more specialized toold to convert windows text files to unix text files (only a NEWLINE at end of each line).

Windows do not have such tools by default :-(

I look at this problem in IM Examples, Text to Image Processing, Multiple Line Labels...
http://www.imagemagick.org/Usage/text/#multi-lines

However it is likely the IM should automatically ignore RETURN characters so prehaps you would like to submit a bug report in the bugs forum. Reference this topic if you want. However that will not help you with your current problem, so you may need to DIY your own text file conversion solution (or search for a utility on the web).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
applejax

Re: Vertical Spacing issue

Post by applejax »

I saved it as a unix text document in word pad and still get the same result....you know cuz there are the 2 options to save as text or text (ms-dos). i don't have linux on my machine.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Vertical Spacing issue

Post by anthony »

Without being able to examine the file I cound not tell you if it is 'return' characters or not that is the problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply