Add multiple lines of text

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

Post Reply
wonzling
Posts: 3
Joined: Wed Jan 06, 2021 4:32 pm

Add multiple lines of text

Post by wonzling »

Hello, i want to add some text to an foto with this:

Code: Select all

C:\Users\XXXXXX\Desktop\NConvert>nconvert -canvas #1 #500 top-center -bgcolor 255 005 255 -ratio -rtype lanczos  -text_font "Arial" 100 -text_color 0 0 0 -text_flag bottom-center -text_pos 0 -400 -text_rotation 0 -text "Hello Test" TEST.jpg
This code works perfect.
Now i want the text under the image in two lines:

Hello
Test

I have tried to export from XNView MP but also this not works ...
Can someone help me?
Thanks
cday
XnThusiast
Posts: 2905
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Add text

Post by cday »

The problem, ignoring all the other details, is how to use the -text option to insert two lines of text, if that is actually possible?

In XnView MP Batch convert (or XnConvert) pressing the 'Enter' key creates a second text line in the image preview, and the exported code has a line break at that point, have you tested what happens if you put a line break in your code, quite possibly nothing?

If a line break in the code doesn't work, I'm not sure whether there is any other character that might be recognised as a line break?

If those possibilities don't work, my only immediate suggestion would be to write the two lines in separate lines of code.
cday
XnThusiast
Posts: 2905
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Add multiple lines of text

Post by cday »

Update:

I've now tested with a line break ('Enter') in the code line, and not surprisingly the code doesn't run.

So the only solution would seem to be to use two lines of code, to write first one line of text, then the second one below.

@Pierre: Is there any way to write two lines of text using one line of code, to force a new line?

Text_1
Text_2
wonzling
Posts: 3
Joined: Wed Jan 06, 2021 4:32 pm

Re: Add multiple lines of text

Post by wonzling »

cday wrote: Wed Jan 06, 2021 7:51 pm Update:

I've now tested with a line break ('Enter') in the code line, and not surprisingly the code doesn't run.

So the only solution would seem to be to use two lines of code, to write first one line of text, then the second one below.

@Pierre: Is there any way to write two lines of text using one line of code, to force a new line?

Text_1
Text_2
thank you for your reply. Also I have only the Idea with two lines of code ... But if @Piere have an solution ...
User avatar
xnview
Author of XnView
Posts: 35492
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Add multiple lines of text

Post by xnview »

wonzling wrote: Thu Jan 07, 2021 10:47 am thank you for your reply. Also I have only the Idea with two lines of code ... But if @Piere have an solution ...
No, but i'll add in next version \n as new line character...
Pierre.
wonzling
Posts: 3
Joined: Wed Jan 06, 2021 4:32 pm

Re: Add multiple lines of text

Post by wonzling »

@Piere. OK thank you.
A suggestion: start nconvert with the XBS from XNVIEW MP. This would be nice.
Like:
nconvert -Test.xbs
:D
User avatar
xnview
Author of XnView
Posts: 35492
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Add multiple lines of text

Post by xnview »

wonzling wrote: Fri Jan 08, 2021 4:39 pm @Piere. OK thank you.
A suggestion: start nconvert with the XBS from XNVIEW MP. This would be nice.
Like:
nconvert -Test.xbs
:D
And what about xnconvert test.xbs?
Pierre.
User avatar
Peter2
XnThusiast
Posts: 1261
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Re: Add multiple lines of text

Post by Peter2 »

xnview wrote: Fri Jan 08, 2021 10:11 am No, but i'll add in next version \n as new line character...
Fine - I'm just looking for it too.

@Xnview:
Do you already know when you will release the next version?
XnView 2.49.4 German, Win 10
User avatar
Peter2
XnThusiast
Posts: 1261
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Re: Add multiple lines of text

Post by Peter2 »

See in version 2.49.5, Feb 02, 2021
XnView 2.49.4 German, Win 10
User avatar
Peter2
XnThusiast
Posts: 1261
Joined: Thu Nov 24, 2005 3:07 pm
Location: CH

Re: Add multiple lines of text

Post by Peter2 »

xnview wrote: Fri Jan 08, 2021 10:11 am No, but i'll add in next version \n as new line character...
@Pierre
please add this info also to the "-help" section.
XnView 2.49.4 German, Win 10
Post Reply