Page 1 of 1

Different gravity for translate and scale

Posted: 2016-08-02T02:41:50-07:00
by rotem
Hi all,

I'm trying to position a text with one gravity and the scale it with another, is that possible?

This is a command I'm currently using which isn't working

Code: Select all

convert -quality 100 input.jpg -font assets/grobold.ttf -pointsize 21 -stroke "none" -fill "white" -draw " gravity North translate 0,0 skewX 0 skewY 0 rotate 0 gravity Center scale 2,2 text 0,0 'Hello' " result.jpg
Thanks

Re: Different gravity for translate and scale

Posted: 2016-08-02T09:25:33-07:00
by fmw42
How is it not working? What results do you get? You can post to some place such as dropbox.com and put the URL here?

I would break it up. start with one argument and test, then add another argument and test, and so on. Find where it breaks.

Note, that -quality 100 should come properly at the end before your output, though in IM 6, it probably does not matter.

Please always provide your IM version and platform, since syntax differs and if an old version, there may be bugs.

Everything works fine for me without the gravity center and then with the gravity center using IM 6.9.5.4 Q16 Mac OSX. Note you did not specify a pointsize.

Code: Select all

convert -size 250x250 xc:white -font arial -pointsize 21 -fill "black" -pointsize 36 -draw "gravity North translate 0,0 skewX 0 skewY 0 rotate 0 scale 2,2 text 0,0 'Hello'" -quality 100 result2.jpg
In the above, the text is at the top center and is twice as large as without the scale

Code: Select all

convert -size 250x250 xc:white -font arial -pointsize 21 -fill "black" -pointsize 36 -draw "gravity North translate 0,0 skewX 0 skewY 0 rotate 0 gravity center scale 2,2 text 0,0 'Hello'" -quality 100 result3.jpg
In the above the text is in the center and is twice as large as without the scale.


Is this not what you expect. If not, what are you expecting?

Re: Different gravity for translate and scale

Posted: 2016-08-02T22:51:29-07:00
by rotem
Hey fmw42

I actually managed to find another solution to my main problem but let me answer all of your questions.

The version I'm using is 6.9.4-3 Q16 x86_64 2016-05-23.

The result for the this script

Code: Select all

convert -size 250x250 xc:white -font arial -pointsize 36 -fill "black" -draw "gravity North translate 0,0 skewX 0 skewY 0 rotate 0 gravity Center scale 2,2 text 0,0 'Hello'" -quality 100 result2.jpg
is this

Image

what I want to get is something more resemble to this

Image

since the scaling suppose to be executed after the positioning

Re: Different gravity for translate and scale

Posted: 2016-08-02T22:56:30-07:00
by fmw42
I get the text near the top and all visible with IM 6.9.5.4 Q16 Mac OSX (removed gravity center)

Code: Select all

convert -size 250x250 xc:white -font arial -pointsize 21 -fill "black" -pointsize 36 -draw "gravity North translate 0,0 skewX 0 skewY 0 rotate 0 scale 2,2 text 0,0 'Hello'" -quality 100 result2.jpg

Re: Different gravity for translate and scale

Posted: 2016-08-03T00:16:41-07:00
by rotem
Yeah but I want it to be like the second example.
I want that the first gravity will effect the translate and the second gravity the scale.

Is that possible?

Re: Different gravity for translate and scale

Posted: 2016-08-03T09:01:54-07:00
by fmw42
Scale is scale. Gravity is not relevant, except for final positioning/justification. I am not sure what you actually want. I gave two examples. The first had the text at the top as you seemed to have wanted. The second had the same size text, but was ultimately in the center of the image. What do you want that is different from either of these?

Re: Different gravity for translate and scale

Posted: 2016-08-03T22:13:32-07:00
by rotem
Well, I'm building a scaling animation and if the gravity of the drawing is Center the animation looks better since the scaling occur in the same ratio from all directions but if I use different gravity (North for example) the scaling occur from the West, East & South directions and not the North which creates a kinda different animation.

Re: Different gravity for translate and scale

Posted: 2016-08-03T22:17:33-07:00
by fmw42
rotem wrote:Well, I'm building a scaling animation and if the gravity of the drawing is Center the animation looks better since the scaling occur in the same ratio from all directions but if I use different gravity (North for example) the scaling occur from the West, East & South directions and not the North which creates a kinda different animation.

Can you provide the command and result that fails for say North?

Re: Different gravity for translate and scale

Posted: 2016-08-03T22:18:02-07:00
by fmw42
Are you using the latest version of IM?

Re: Different gravity for translate and scale

Posted: 2016-08-03T22:33:01-07:00
by rotem
I'm not sure, I'm using ver 6.9.4-3 Q16 x86_64 2016-05-23. but I don't think there is a problem with IM, I actually think it working properly. I thought that maybe there is a way to tell the drawing to use different gravity for the scaling only.

Re: Different gravity for translate and scale

Posted: 2016-08-03T23:25:21-07:00
by fmw42
All that does is change the final justification. Scaling is gravity insensitive.

Re: Different gravity for translate and scale

Posted: 2016-08-04T01:38:00-07:00
by rotem
I understand, thanks