Re: animations using image magick

From: Dave Allured - NOAA Affiliate <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 16 2014 - 15:30:56 MDT

Jon,

For what it's worth, I got slightly better image resolution by making
single frame PNG files with NCL, rather than postscript. Then I used
convert ONLY to combine the frames into an animated GIF. PNG to GIF is a
raster to raster conversion, which avoids image resampling if you don't
tell convert to resize. Something like this:

   convert -delay 50 frame*.png out.gif

This was several years ago, but I think it should still work.

--Dave

On Wed, Jul 16, 2014 at 2:23 PM, Jon Meyer <jonathan.meyer@aggiemail.usu.edu>
wrote:
>
> Thanks Adam, I've spent the last day google-sluething on why this was
happening and hadn't found any good hints so I was hoping an NCL user would
have a clue (and you quickly did!).
>
> I guess if I would have followed the first animation example, which
creates a single .ps file for each frame, I would have saved myself the
headache, but I opted for the less cluttered directory and followed the
second example which produces and converts the single .ps file.
>
> Thanks for the solution, I'll embed the convert command between the
psplit and a 'rm pict*.ps' call to delete the 'intermediate" .ps files and
have the best of both worlds.
>
> Jon
>
>
> On Wed, Jul 16, 2014 at 1:57 PM, Adam Phillips <asphilli@ucar.edu> wrote:
>>
>> Hi Jon,
>> (To be clear, Image Magick is not supported by the NCL group, although I
do believe it to be heavily used by NCL users.)
>>
>> I don't see anything amiss with your NCL script. I was able to get the
animation to stop jumping around though by separating the .ps file input 3
ps files (by using "psplit WindsClimo.ps") and then issuing the convert
command.
>>
>> Hope that helps..
>> Adam
>>
>>
>>
>>
>> On Wed, Jul 16, 2014 at 1:39 PM, Jon Meyer <
jonathan.meyer@aggiemail.usu.edu> wrote:
>>>
>>> Hi,
>>>
>>> I am using NCL to create .ps files with multiple pages that are
converted to .gif files using a call to image magick from NCL.
>>>
>>> I am following this example:
http://www.ncl.ucar.edu/Applications/Scripts/animate_2.ncl
>>>
>>> While the .ps files all appear normal and acceptable, the .gif frames
are not aligned appropriately after the first frame is plotted. I have
tried using the -dispose flag to clear previous frames, but the issue
persists.
>>>
>>> Attached is a copy of the original .ps file, and the converted .gif
file to demonstrate the issue.
>>>
>>> Thanks,
>>> Jon
>>>
>>> Below is the pertinent code snippet:
>>>
>>>
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>> ;Begin plotting
>>>
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>>
>>> fig_name = "WindsClimo"
>>> wks = gsn_open_wks("ps", "Animations/"+fig_name)
>>> gsn_define_colormap(wks, "WhiteBlueGreenYellowRed")
>>>
>>> ; =================================================================
>>> ; ASSIGN PLOT RESOURCES
>>> ; =================================================================
>>>
>>> res = True
   ;use desired resources set below
>>> ; res@gsnMaximize = True
>>> res@gsnSpreadColors = True
>>> ; res@gsnFrame = False
>>> ; res@gsnDraw = False
>>> res@gsnRightString = " "
>>> res@gsnLeftString = " "
>>> res@gsnStringFontHeightF = 0.02
>>>
>>> res@mpFillOn = False
>>> res@mpLimitMode = "Corners"
>>> res@mpUSStateLineColor = "black"
>>> res@mpOutlineBoundarySets = "GeophysicalAndUSStates"
>>> res@mpProjection = "Mercator"
>>> res@mpLeftCornerLatF = lat(0,0)
>>> res@mpLeftCornerLonF = lon(0,0)
>>> res@mpRightCornerLatF = lat(n_lat-1,n_lon-1)
>>> res@mpRightCornerLonF = lon(n_lat-1,n_lon-1)
>>>
>>> res@pmTickMarkDisplayMode = "Always" ; Turn on
map tickmarks.
>>>
>>> res@vcRefLengthF = 0.08
>>> res@vcGlyphStyle = "CurlyVector"
>>> res@vcMinDistanceF = 0.04
>>> res@vcRefAnnoBackgroundColor = "grey"
>>> res@vcRefAnnoFontHeightF = 0.02
>>> res@vcRefAnnoOrthogonalPosF = -0.20
>>> res@vcRefAnnoParallelPosF = .93
>>>
>>> ; =================================================================
>>> ; CREATE THE PLOTS
>>> ; =================================================================
>>>
>>> plot =
gsn_csm_vector_map(wks,U_climo(0,0,0,:,:),V_climo(0,0,0,:,:),res)
>>> plot =
gsn_csm_vector_map(wks,U_climo(1,0,0,:,:),V_climo(1,0,0,:,:),res)
>>> plot =
gsn_csm_vector_map(wks,U_climo(2,0,0,:,:),V_climo(2,0,0,:,:),res)
>>>
>>> ; =================================================================
>>> ; CONVERT PS TO GIF ANIMATION
>>> ; =================================================================
>>>
>>> delete(wks) ; Make sure PS file is closed
>>> system("rm Animations/"+fig_name+".gif")
>>> cmd = "convert -delay 125 Animations/"+fig_name+ ".ps Animations/"
+fig_name+".gif"
>>> system(cmd)
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist, Climate and Global Dynamics Division, NCAR
>> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

Received on Wed Jul 16 09:31:04 2014

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT