[ncl-talk] PNG trim error before doing animated Gif, all the space outside the trimmed area now is black colored.

Don Murray (NOAA Affiliate) don.murray at noaa.gov
Wed Sep 23 12:54:42 MDT 2015


Try using -trim +repage:

cmd="convert -trim +repage 
animate"+sprinti("%03i",n)+".png"+"animate"+sprinti("%03i",n)+".png"

Don

On 9/23/15 12:24 PM, Sebastian Otarola-Bustos wrote:
> Hi everybody,
>
> I've been making animations without troubles converting .png to .gif
> using the following commands: convert -trim & convert -delay, so I'm
> cutting the white space with trim and then doing the animation with
> -delay. The strange thing is that if I see each .png file separately,
> it's cutted ok, as it showns in Figure1, but after doing the animation
> with the cutted files, you can see the trimmed area, but the difference
> between the cutted area and the original size is all filled with black
> as you can see in Figure2. Here you can see the main steps of my scripts:
>
>
> *do n=0,ntimes-1,4*
> *
> *
> *wks_type            = "png"*
> *      wks_type at wkWidth    = 1700*
> *      wks_type at wkHeight   = 1700*
> *      wks = gsn_open_wks("png","animate"+sprinti("%03i",n))  ;
> animate_000.png, animate_001.png, etc*
> *      print("Trabajando en el tiempo: " + times(n))*
> *      mpres at gsnRightString  = " Velocity(m/s):  "+ times(n)*
> *      mpres at gsnLeftString = " "*
> *
> *
> *      mpid   = gsn_csm_map(wks,mpres)*
> *      V  = gsn_csm_contour(wks,speed(n,:,:),spres)*
> *      wind = gsn_csm_vector(wks,u(n,:,:),v(n,:,:),Vres)*
> *      Heig    =gsn_csm_contour(wks,ter(:,:),ter_res)*
>
> *      overlay(mpid,V)*
> *      overlay(mpid,Heig)*
> *      overlay(mpid,wind)*
> *      maximize_output(wks,True)*
> *      delete(wks)*
> *cmd="convert -trim animate"+sprinti("%03i",n)+".png
> "+"animate"+sprinti("%03i",n)+".png"*
> *      system(cmd)*
> *  end do
> INS = "convert -delay 50 animate*.png velocity_3.gif"
>   system(INS)
>
> *
>
> I still cannot see the error, and any help would be really appreciated
> as always,
>
> All the best,
> Thank you very much,
> Sebastián.
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Don Murray
NOAA/ESRL/PSD and CU-CIRES
303-497-3596
http://www.esrl.noaa.gov/psd/people/don.murray/


More information about the ncl-talk mailing list