Page 1 of 1

Convert command too complexe ??

Posted: 2009-02-12T22:29:25-07:00
by taz742
Well first : congratulation to the IM Developer because IM is a very powerful tool , but hard to understand sometimes.

So my problem I have a command line which partially work as expected (here a short version):

Code: Select all

convert ^
	-page +4+4 ^
		( -size 128x24 xc:none -gravity center ^
			-font "Arial" -pointsize 18 ^
			-stroke #FFFFFF -strokewidth 3 -annotate 0 "00:01:20" -blur 0x8 ^
			-stroke none -fill #000000 -annotate 0 "00:01:20" ^
			+trim +size "_000.jpg[511x383]" ^
			+swap -gravity southeast -geometry +1+1 -composite ) ^
	-page +519+4 ^
		( -size 128x24 xc:none -gravity center ^
			-font "Arial" -pointsize 18 ^
			-stroke #FFFFFF -strokewidth 3 -annotate 0 "00:02:40" -blur 0x8 ^
			-stroke none -fill #000000 -annotate 0 "00:02:40" ^
			+trim +size "_001.jpg[511x383]" ^
			+swap -gravity southeast -geometry +1+1 -composite ) ^
	-background none -mosaic ^
	( +clone -shadow 80x1+4+4 ) ^
	+swap -background #9A9A9A -mosaic ^
	-filter lanczos -resize 1024 -quality 100 "Canvas.jpg"
And the return error is:

Code: Select all

convert.exe: geometry does not contain image `none' @ statistic.c/GetImageBoundingBox/217.
As you could see here: Image only the first time stamp is adding on first shot
but I want a time stamp for each shot...
Is it possible to do this using only convert.exe in one command?

Thank in advance for your help.

PS: I'm using "ImageMagick 6.4.8-7 2009-01-16 Q16"

Re: Convert command too complexe ??

Posted: 2009-02-13T00:21:53-07:00
by taz742
I found a way to do it using -write mpr:#

Code: Select all

convert ^
	( -size 128x24 xc:none -gravity center ^
		-font "Arial" -pointsize 18 ^
		-stroke #FFFFFF -strokewidth 3 -annotate 0 "00:01:20" -blur 0x8 ^
		-stroke none -fill #000000 -annotate 0 "00:01:20" ^
		+trim +size "_000.jpg[511x383]" ^
		+swap -gravity southeast -geometry +1+1 -composite -write mpr:1 +delete ) ^
	( -size 128x24 xc:none -gravity center ^
		-font "Arial" -pointsize 18 ^
		-stroke #FFFFFF -strokewidth 3 -annotate 0 "00:02:40" -blur 0x8 ^
		-stroke none -fill #000000 -annotate 0 "00:02:40" ^
		+trim +size "_001.jpg[511x383]" ^
		+swap -gravity southeast -geometry +1+1 -composite -write mpr:2 +delete ) ^
	-page +4+4 mpr:1 ^
	-page +519+4 mpr:2 ^
	-background none -mosaic ^
	( +clone -shadow 80x1+4+4 ) ^
	+swap -background #9A9A9A -mosaic ^
	-filter lanczos -resize 1024 -quality 100 "_Canvas_try.jpg"
Image
but if someone have a better way (if exist) he's welcome

Re: Convert command too complexe ??

Posted: 2009-02-14T03:02:47-07:00
by anthony
NOTE you can NOT draw a fill color of 'none' It is transparent, and draws nothing!

What I would do is first forget about using -page or placing the labels exactly.
Instead I would look more at just appending the various parts together.

So first read in the image, and pad it out to the size, then generate and append the label,
Repeat, and append all together.

Something like (untested)

Code: Select all

convert ^
   (  +size  "_000.jpg[510x383]"  -^
       -background black -gravity South -extent 512x386 ^
       ( -size 128x24 xc:black -gravity center ^
         -font "Arial" -pointsize 18 ^
         -stroke #FFFFFF -strokewidth 3 -annotate 0 "00:01:20" -blur 0x8 ^
         -stroke black -fill #000000 -annotate 0 "00:01:20" ^
       ) -background black -gravity South East -append ^
  ) ^
  ... repeat above for each image ....
  +append    "_Canvas_try.jpg"
Note that each image is -extent (padded) into a fixed size image
then each label (also a fixed size) is appended with right alignment
so each 'block' becomes a fixed sized image on a black canvas.
Hmmm 512 pixels wide and 386 + 24 => 410 pixel high.
If two images are appended you get 1024x410 image.

AT no time is transparency involved.


NOTE I am a unix person, I have not tested the above, but don't see any problems with it.

Re: Convert command too complexe ??

Posted: 2009-02-14T07:31:44-07:00
by taz742
Thanks for your fast reply.

I will test it but I think i won't like the fact the text was append at southeast because i wish to placed it over the shot at southeast.
No matter, actually my second command work fine: it reduce by 50% the time needed before with another script.