Page 2 of 2

Re: Convert inside convert, want to use result of inner converts without writing to disk

Posted: 2015-08-23T16:36:34-07:00
by chaoscarnage
snibgo wrote: At the end, you have "-composite" with no "-compose" setting, so this will also be "Dst_Out".

The default setting of "-compose" is "Over".
This looks to be why it wasn't working. A million thank yous!

Re: Convert inside convert, want to use result of inner converts without writing to disk

Posted: 2015-08-23T16:41:03-07:00
by chaoscarnage
Also can I just casually call -compose in between overall calls like so?

Code: Select all

convert \
   -compose Dst_Out \

   source2.png \
      subsource1.png -composite \
      subsource2.png -composite \
   +write mpr:convert_result_1 \
   +delete \
   
   source3.png \
      subsource1.png -composite \
   +write mpr:convert_result_2 \
   +delete \
   
   -compose Over \
   blank.png \
   ....\
   

Re: Convert inside convert, want to use result of inner converts without writing to disk

Posted: 2015-08-23T17:00:13-07:00
by snibgo
chaoscarnage wrote:Also can I just casually call -compose in between overall calls like so?
Yes. You set compose to Dst_Out at the start. It remains at that setting until you change it with "-compose Over".

Re: Convert inside convert, want to use result of inner converts without writing to disk

Posted: 2015-08-23T18:34:49-07:00
by 246246
chaoscarnage wrote: I am programmatically creating a string to call using PHP Exec() to combine a bunch of images together sometimes in a specific way.
OK. Then consider about your first simple case.

If you just want to compose n file to background,

Code: Select all

convert background src_1 -compose over -composite tmp_1
convert tmp_1      src_2 -compose over -composite tmp_2
...
convert tmp_n-1    src_n -compose over -composite target
will work of course.

To remove temporary file using correct syntax. If input is 2 file,

Code: Select all

convert
	\( background src_1 -compose over -composite \)
	src_2
	-compose over -composite
	target
In this case, you can omit parenthesis. So nth case

Code: Select all

convert
	background
	src_1
	-compose over -composite
	src_2
	-compose over -composite
	
	[...]
	
	src_n
	-compose over -composite
	target
chaoscarnage wrote: However, I need to go a step further and modify a couple of the images before they get added to the overall image.
If you want to do something special for src2, your code would be like the following.

Code: Select all

convert
	background
	src_1
	-compose over -composite
	\( [do something special to src_2] \)
	-compose over -composite
	
	[...]
	
	src_n
	-compose over -composite
	target
For example, If special operation is compose from sub2_1 and sub2_2 using dst_over

Code: Select all

convert
	background
	src_1
	-compose over -composite
	\( sub2_1 sub2_2 -compose dst_over -composite \)
	-compose over -composite
	
	[...]
	
	src_n
	-compose over -composite
	target