Page 2 of 2

Re: Timestamp out of filename

Posted: 2016-09-10T01:52:02-07:00
by snibgo
You need a space before and after every \( and \) .

Re: Timestamp out of filename

Posted: 2016-09-10T03:02:57-07:00
by max2331
Thank you, now it works.

But one more thing:

I tried for another action

Code: Select all

composite 2016081711230002dBuZ.ppi_top.png -set filename:f "%[t]" -gravity center Background_final.png "%[filename:f]_2.png"
On the HP of Imagemagick it says that composite knows how to deal with -set but i get:

unrecognized option -set @ error/composite.c/CompositeImageCommand/1438

I make several steps with 2016081711230002dBuZ.ppi_top.png and always want to keep the filename similar, just with an _1 or _2 at the end.
How can i do this?

Re: Timestamp out of filename

Posted: 2016-09-10T03:12:23-07:00
by snibgo
I never use "composite". It can't do anything that "convert" can do, and "convert" is maintained better.

Re: Timestamp out of filename

Posted: 2016-09-10T04:37:11-07:00
by max2331
Thank you
This works so far

Code: Select all

convert Background_final.png 2016081711230002dBuZ.ppi_top.png -set filename:f "%[t]"  -gravity center -composite "%[filename:f]_2.png"
But how can i tell to read the second filename? now my output is:
Background_final_2.png but i want 2016081711230002dBuZ.ppi_top_2.png
But if i change it, the background will be on top.

Re: Timestamp out of filename

Posted: 2016-09-10T17:39:56-07:00
by GeeMack
max2331 wrote:But how can i tell to read the second filename?
I'm not sure I understand, but it looks like you want the output file name to come from the second input file. That "%[filename:f]" variable doesn't always behave the way you might expect, so I use a workaround like this...

Code: Select all

convert Background_final.png \
   \( 2016081711230002dBuZ.ppi_top.png -set option:fname "%[t]" \) \
   -composite -set filename:f "%[fname]" "output_%[filename:f].png"
That isolates your second input file in parentheses and puts its name into a variable. I made up the name "fname". It can be anything. Then just before the final output, feed that variable into your "%[filename:f]" variable. I know it looks a little clumsy, but that's the most reliable way I've found to make it work.