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

Alan Brammer abrammer at albany.edu
Thu Sep 24 10:54:39 MDT 2015


As David said it's not NCL but imagemagick.

http://www.imagemagick.org/Usage/crop/#trim

" First is like "-crop", "-trim" will retain the canvas size of the image."

GIF isn't a very complex format and doesn't know what to do with the empty
space so makes it black.  Different viewers will probably handle it
differently.

from the above page again:
"However if you don't care about this information, just junk it by
resetting the page information of the image either using a "+repage"
operator, or saving to a format that does not save canvas information (such
as the JPEG format). Here we do both, to make it clear, that we are junking
the canvas information."

Alan.

On Thu, Sep 24, 2015 at 12:24 PM, Sebastian Otarola-Bustos <
Sebastian.F.Otarola-Bustos.1 at nd.edu> wrote:

> I'm not sure what was the error, but I followed your suggestion and now
> works fine.
>
>
>
> All the best,
> Sebastián.
>
>
>
>
>
> On Wed, Sep 23, 2015 at 6:53 PM, David Jones <jonesd647 at yahoo.ca> wrote:
>
>> Not an NCL problem, but you could try "convert -trim +repage".
>>
>> Good luck,
>> Dave.
>>
>>
>>
>> On Wednesday, September 23, 2015 11:25 PM, "ncl-talk-request at ucar.edu" <
>> ncl-talk-request at ucar.edu> wrote:
>>
>>
>> ----------------------------------------------------------------------
>>
>> Date: Wed, 23 Sep 2015 15:24:47 -0300
>> From: Sebastian Otarola-Bustos <Sebastian.F.Otarola-Bustos.1 at nd.edu>
>> Subject: [ncl-talk] PNG trim error before doing animated Gif, all the
>>     space outside the trimmed area now is black colored.
>> To: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Message-ID:
>>     <CAO9pyik1_R50FwZwhs=VcywLhovGSLEnx5LGkm0LkMtX4E1X7w at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> 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 doINS = "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.
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150923/544fdb0d/attachment-0001.html
>>
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: Figure_1.PNG
>> Type: image/png
>> Size: 124596 bytes
>> Desc: not available
>> Url :
>> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150923/544fdb0d/attachment-0002.png
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: Figure_2.PNG
>> Type: image/png
>> Size: 109313 bytes
>> Desc: not available
>> Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150923/544fdb0d/attachment-0003.png
>>
>>
>> ------------------------------
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150924/24934852/attachment.html 


More information about the ncl-talk mailing list