Convert command too complexe ??

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
taz742

Convert command too complexe ??

Post 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"
taz742

Re: Convert command too complexe ??

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert command too complexe ??

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
taz742

Re: Convert command too complexe ??

Post 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.
Post Reply