Help understanding positioning of image in a movie frame


me again…

i’ve got movie working and i can make animations.

the globe example from the documents works fine.

i’ve got the overlay thing working and am making movies using my own data from layered netCDF files.

what i cannot figure out is the relationship between the frame size and the number of pixels and how the image is positioned within the movie frame etc…

in the example for the globe you use -C6ix6ix100 for a 600x600 pixel image, and it fills the space perfectly

in my example, i am trying a 15cx16.3cx100 image and it shunts my image up and to the right such that i can only see the lower left corner of the plot as below:

for this i am using -JM180/0/${MOVIE_WIDTH} as the projection.

I also tried using -JM180/0/15c as the projection then I used -C2200px2409px1 and the resulting image looks like:

i.e. really small and in the lower left corner. but the animated gif works fine, i.e. the image moves as expected.

the movie script i am using looks like:

gmt movie -Nanim -T10 -Agif+l -C15cx16.43cx100 -Vl #2200px2409px1

and the plotting script looks like:


echo $region
project=-JM180/0/${MOVIE_WIDTH} #15c 

gmt begin  
	gmt set MAP_ORIGIN_X 0p
	gmt set MAP_ORIGIN_Y 0p
	gmt set FORMAT_GEO_MAP +D.x
	gmt makecpt -Cjet -D -M -T-1000/1000/1  -H > tmp.cpt
	gmt grdimage $datafile?ha[${MOVIE_FRAME}] $region $project $border  -Ctmp.cpt -Q 
	gmt colorbar -Dx3c/18c+w4c/0.5c+jTC+m -Bxaf+l"Tsunami Amplitude" -By+lcm -Ctmp.cpt
	gmt coast $region $project $border -W -Df -Ggrey -N1/1p,white  
gmt end 

also putting one of the somewhat working animations in as an example:


For this one i used -C1100px1204px1 and the image is still not ‘full frame’.

have tried all sorts of other combinations, but i still cannot see how the size of the image relates to the positioning and size within the movie frame.

i obtained my pixel dimensions by plotting one frame with the -JM180/0/15c and noting that the resulting image was 2200x2409 pixels, so this gave me the aspect ratio.


Make sure you use -X -Y to position your grdimage. Since GMT default is -X72p -Y72p and you use $MOVIE_WIDTH which is the width of the frame then you will be plotting 72p beyond the width.
Unless I have very specific plots I try to use the preset video formats like HD to set up the size of the frames.

Hi Paul,

Ok, I get that, sort of, and I did play around with the -X and -Y before I asked my question…

But why then is no -X -Y correction needed for the Globe example?

Also, for my first example above, the -X and -Y values would be negative to pull the image down and to the left.

Anyway, I haven’t had time to mess with it in the past few of days, I’ll try to have a look over the weekend and see if I can figure it out.


My version of movie.rst has

   gmt coast -Rg -JG${MOVIE_FRAME}/20/${MOVIE_WIDTH} -Gmaroon -Sturquoise -Bg -X0 -Y0

perhaps you are looking at the 6.0.0 pages and they miss that.

@pwessel I figured it out…

Indeed the -X0 and -Y0 were there in my documentation, i just never noticed them. So yes, with a bit of fiddling, I got the animation to work.

In the next bit of free time I get, I will work on using the background and foreground scripts and on getting the time text to update etc…