Uniting different commands in a single one
Re: Uniting different commands in a single one
The position is relative to the geometry so for north west the position of text one would be 444 in x and 6 in y from the top left corner.
For west it will be 444 in x and 6 in y from the middle left of the image and so that would be 444 in x and ( 2856 / 2 ) + 6 in y which is 1434 from the top left corner.
From memory some strang things happen as +x in west is to the right but +x in east is to the left
For west it will be 444 in x and 6 in y from the middle left of the image and so that would be 444 in x and ( 2856 / 2 ) + 6 in y which is 1434 from the top left corner.
From memory some strang things happen as +x in west is to the right but +x in east is to the left
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
yes i can see the problem now
the problem is that the -gravity in each individual text i need it to be the positioning of each text within its own bounding box (for simulating left, center and right aligned text)
so that doesnt work
thats why it works when done separately, example
convert -background none -fill #ff33cc -font Arial -pointsize 60 -rotate 0 -gravity East label:"hello \n how are you " image1.png
(this creates a text right aligned )
that text then gets composited with the rest
however with the compact version this breaks, because the -gravity and -geometry are positioning things respect to the entire image,
mmmm how could i solve this
the problem is that the -gravity in each individual text i need it to be the positioning of each text within its own bounding box (for simulating left, center and right aligned text)
so that doesnt work
thats why it works when done separately, example
convert -background none -fill #ff33cc -font Arial -pointsize 60 -rotate 0 -gravity East label:"hello \n how are you " image1.png
(this creates a text right aligned )
that text then gets composited with the rest
however with the compact version this breaks, because the -gravity and -geometry are positioning things respect to the entire image,
mmmm how could i solve this
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
what i need in a single command is to be able to use -gravity to align multiline texts left, center or right,
and at the same time composite those texts with the default northwest within the whole large canvas
its really that simple, but so far not working
so i have a series of multiline texts, -gravity helps me to make them right, center or left aligned
(left aligned)
hello
how are you
(center aligned)
hello
how are you
(right aligned)
hello
how are you
and then those texts get composited with the default NorthWest within the large canvas
how can i tweak the compact single command to do that?
thank you
and at the same time composite those texts with the default northwest within the whole large canvas
its really that simple, but so far not working
so i have a series of multiline texts, -gravity helps me to make them right, center or left aligned
(left aligned)
hello
how are you
(center aligned)
hello
how are you
(right aligned)
hello
how are you
and then those texts get composited with the default NorthWest within the large canvas
how can i tweak the compact single command to do that?
thank you
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
basically all the -gravitys of all the elements have to be NorthWest in respect to the entire canvas, all of them
what i need now is separated -gravitys to specify left,center or right alignment for the multiline texts themselves (respect to their own boundaries, not the entire canvas)
what i need now is separated -gravitys to specify left,center or right alignment for the multiline texts themselves (respect to their own boundaries, not the entire canvas)
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
as it says on the usage page
gravity
* It is also used, as means of specifying the text justification by the various text to image generators such as "label:" and the text justification by the various text to image generators such as "caption:".
* The "-annotate" text drawing operator also uses it for text positioning as well as justification.
therefore i need to use gravity for justification as well as text positioning, both in the same command,
thats the best summary yeah
need to justify the multiline texts + position them relative to large canvas
gravity
* It is also used, as means of specifying the text justification by the various text to image generators such as "label:" and the text justification by the various text to image generators such as "caption:".
* The "-annotate" text drawing operator also uses it for text positioning as well as justification.
therefore i need to use gravity for justification as well as text positioning, both in the same command,
thats the best summary yeah
need to justify the multiline texts + position them relative to large canvas
Re: Uniting different commands in a single one
Try this - for some reason the last one always fails:
Code: Select all
<?php
$cmd = " -size 2040x2856 xc:none ".
" ( -background none -fill #ff33cc -font Arial -pointsize 60 -gravity west label:\"hello\\nhow are you\" ) -geometry +438+114 -composite ".
" ( -background none -fill #ff55cc -font Arial -pointsize 40 -gravity east label:\"hello\\nhow are you\" ) -geometry +840+342 -composite ".
" ( -background none -fill #ff11cc -font Arial -pointsize 20 -gravity center label:\"hello\\nhow are you\" ) -geometry +1040+1342 -composite ".
" -quality 95 ";
exec(" convert $cmd finalresultingimage.png ");
?>
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
reading this that Anthony wrote
"At this time IM does not make a distinction between using 'gravity' for placement,
and 'justification' (horizontally or vertically) of text and images at the position gravity determined. I have previously proposed that a 'justification' setting be created but have it default appropriately according to the current gravity setting when undefined."
does this mean that there is no way to accomplish in same command both justification+gravity of the same multiline text, and that i have to do it in separate commands?
"At this time IM does not make a distinction between using 'gravity' for placement,
and 'justification' (horizontally or vertically) of text and images at the position gravity determined. I have previously proposed that a 'justification' setting be created but have it default appropriately according to the current gravity setting when undefined."
does this mean that there is no way to accomplish in same command both justification+gravity of the same multiline text, and that i have to do it in separate commands?
Re: Uniting different commands in a single one
It seems ImageMagick is getting confused with the code all on one line.
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
thank you very much Bonzo, i tried that
but no luck so far, this is the command i tried
convert -size 2040x2856 xc:none ( -background none -fill #99ff00 -font Arial -pointsize 600 -rotate 0 -gravity West label:"text1" ) -geometry +444+6 -composite ( -background none -fill #ffffcc -font Arial -pointsize 60 -rotate 0 -gravity West label:"text2" ) -geometry +1350+2172 -composite -quality 95 finalresult.png
i feel it should work, looks very logical, im going to try again
but no luck so far, this is the command i tried
convert -size 2040x2856 xc:none ( -background none -fill #99ff00 -font Arial -pointsize 600 -rotate 0 -gravity West label:"text1" ) -geometry +444+6 -composite ( -background none -fill #ffffcc -font Arial -pointsize 60 -rotate 0 -gravity West label:"text2" ) -geometry +1350+2172 -composite -quality 95 finalresult.png
i feel it should work, looks very logical, im going to try again
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
yes you are right imagemagick is getting confused,
basically at the moment the command is taking the gravity and using it to position the texts respect to the total canvas instead of to justify the text itself
convert -size 2040x2856 xc:none ( -background none -fill #99ff00 -font Arial -pointsize 600 -rotate 0 -gravity West label:"text1" ) -geometry +444+6 -composite ( -background none -fill #ffffcc -font Arial -pointsize 60 -rotate 0 -gravity West label:"text2" ) -geometry +1350+2172 -composite -quality 95 finalresult.png
we have to find a way to make that gravity be justification instead
mmm
basically at the moment the command is taking the gravity and using it to position the texts respect to the total canvas instead of to justify the text itself
convert -size 2040x2856 xc:none ( -background none -fill #99ff00 -font Arial -pointsize 600 -rotate 0 -gravity West label:"text1" ) -geometry +444+6 -composite ( -background none -fill #ffffcc -font Arial -pointsize 60 -rotate 0 -gravity West label:"text2" ) -geometry +1350+2172 -composite -quality 95 finalresult.png
we have to find a way to make that gravity be justification instead
mmm
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
i totally agree with Anthony that there should be a separate -justification tag,
i hope there is still a way to solve this somehow
i hope there is still a way to solve this somehow
Re: Uniting different commands in a single one
In my test it did justify the text but the -composite seemed to be in relation to the last composite not the canvas.
I have modded the code so it all displays on an image:
Looks like it is ignoring the -gravity outside the brackets
I have modded the code so it all displays on an image:
Code: Select all
<?php
$cmd = " -size 2040x2856 xc:none ".
" ( -background none -fill #ff33cc -font Arial -pointsize 60 -gravity west label:\"hello\\nhow are you\" ) -gravity northwest -geometry +438+114 -composite ".
" ( -background none -fill #ff55cc -font Arial -pointsize 40 -gravity east label:\"hello\\nhow are you\" ) -gravity northwest -geometry -140+342 -composite ".
" ( -background none -fill #ff11cc -font Arial -pointsize 20 -gravity center label:\"hello\\nhow are you\" ) -gravity northwest -geometry -500+342 -composite ".
" -quality 95 -trim";
exec(" convert $cmd finalresultingimage.png ");
?>
Looks like it is ignoring the -gravity outside the brackets
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
you are right Bonzo, i tried it and the problem is that the final result doesnt appear in a
2040x2856 canvas, it kind of appears in a composite mixture that is not the final sized canvas 2040x2856
2040x2856 canvas, it kind of appears in a composite mixture that is not the final sized canvas 2040x2856
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
sorry, that was because of the -trim
without the -trim, the final canvas size is good,
and the justification seems good, but again the final positioning is not correct, its still taking the gravity as reference point of canvas also
without the -trim, the final canvas size is good,
and the justification seems good, but again the final positioning is not correct, its still taking the gravity as reference point of canvas also
-
- Posts: 180
- Joined: 2010-11-27T01:42:06-07:00
- Authentication code: 8675308
Re: Uniting different commands in a single one
the key here is
if a text has a position of 100,100 relative to top left corner
and that text has a justification of West
the result should be a left (west) justified text in coordinates 100,100
however what we get is a left justified text in coordinates 100,1440 , because the west
is applied to the entire canvas
if a text has a position of 100,100 relative to top left corner
and that text has a justification of West
the result should be a left (west) justified text in coordinates 100,100
however what we get is a left justified text in coordinates 100,1440 , because the west
is applied to the entire canvas