Adding Text: Command line??

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

Moderators: XnTriq, helmut, xnview

Post Reply
miksmith
Posts: 18
Joined: Wed Jun 17, 2009 3:04 pm

Adding Text: Command line??

Post by miksmith »

Hi

I wanted to add some EXIF data as text to an image, something I have done in xnconvert. I then tried to export as an nconvert command and it crashed. The following command *donest* work but Im not sure what the exact syntax should be from the helpfile:

..\nconvert -out jpeg -text_string 'Day 01: {EXIF:Date [H:M]}' -text_font 'Gill Sans MT Condensed' 20.00 -text_color 0 0 0 -text_pos 10 460 GOPR3908.jpg

(although the helpfile says 'text string')

Any help much appreciated!!

thanks

mike
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Adding Text: Command line??

Post by cday »

miksmith wrote:I wanted to add some EXIF data as text to an image, something I have done in xnconvert. I then tried to export as an nconvert command and it crashed. The following command *doesn't* work but Im not sure what the exact syntax should be from the helpfile:

Code: Select all

..\nconvert -out jpeg -text_string 'Day 01: {EXIF:Date [H:M]}' -text_font 'Gill Sans MT Condensed' 20.00 -text_color 0 0 0 -text_pos 10 460 GOPR3908.jpg
I think you may have multiple issues but I'm not entirely sure.

First, in the help file listing...

Code: Select all

-text string      : Add a text
... string is the actual text to be displayed, I think, not part of the syntax, but in my quick test with XnConvert the text string abc is exported for NConvert as "abc" in quotes, so it looks as if the the help file should indicate somehow that the text to be displayed is to be placed within quotes. :?:

Second, I don't see a way of entering EXIF data in XnConvert 1.71, so possibly I'm missing something, or possibly it isn't suported. :?:

I would suggest making a quick test to just enter a simple string such as abc and get that working first.
miksmith
Posts: 18
Joined: Wed Jun 17, 2009 3:04 pm

Re: Adding Text: Command line??

Post by miksmith »

Thanks for the nudge there - helped me experiment further and got the export to nconvert to work (i.e. it didnt crash). This was what it gave me

nconvert -out jpeg -text_font MS Shell Dlg 2 32 -text_color 32 255 0 -text_back 127 0 0 -text_flag top-left -text_pos 10 240 -text_rotation 0 -text "{EXIF:Date [m-d]}" GOPR3908.JPG

which doesnt work. "-text" works on its own with quotation marks as you found however It really doesnt like those spaces between parameters. Ive tried font, colour and position none of which work in or out of quotes (single or double).

It works through xnconvert fine, I just wanted to script it if I could

cheers

m
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Adding Text: Command line??

Post by cday »

I'm not quite sure what you wish to do, but this code exported from XnView Classic works with the input and output file info added:

Code: Select all

nconvert -text_font Calibri 100 -text_color 0 0 0 -text_back 255 255 255 -text_flag top-left -text_pos 0 0 -text_rotation 0 -text "abc" -o image_o.jpg image.jpg
image_o.jpg
image_o.jpg (2.11 KiB) Viewed 1840 times
I also see that EXIF text is supported in XnView Classic batch conversion (but not in XnConvert as far as I can see), so possibly you can continue experimenting...
miksmith
Posts: 18
Joined: Wed Jun 17, 2009 3:04 pm

Re: Adding Text: Command line??

Post by miksmith »

Thats got me nearly to the end! The font, color and positioning all work (for fonts with spaces in the names you need to put them in quotations).

Final thing then.... the EXIF data dont seem to be supported (it is in xnconvert as well as classic as Ive used it in both).

Thanks for the help!!
Post Reply