<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Francesco,<div class=""><br class=""></div><div class="">Before the line “<font face="Menlo" class="">wks = gsn_open_wks(typefile,namefile)</font>”, you can set the “<font face="Menlo" class="">wkBackgroundOpacityF</font>” attribute on the variable “<font face="Menlo" class="">typefile</font>” to 0.0 in order to make the workstation background fully transparent:</div><div class=""><font face="Menlo" class="">typefile@wkBackgroundOpacityF = 0.0</font></div><div class=""><font face="Menlo" class="">wks = gsn_open_wks(typefile,namefile)</font></div><div class=""><br class=""></div><div class="">Please note that this resource is only valid for certain workstation types (for example “png” is valid, but “pdf” and “ps” are not).</div><div class=""><br class=""></div><div class="">The <a href="https://www.ncl.ucar.edu/Document/Graphics/Resources/wk.shtml" class="">workstation resources documentation</a> on our website contains more information about “wkBackgroundOpacityF” and other potentially useful resources. </div><div class=""><br class=""></div><div class="">I hope this helps!</div><div class="">Kevin</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 26, 2018, at 5:29 PM, Francesco Trotta <<a href="mailto:francesco.trotta4@unibo.it" class="">francesco.trotta4@unibo.it</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">Dear ncl-support</div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">   I'm generating a contour_map plot for the ocean temperature<span class="Apple-converted-space"> </span><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">   I would like to generate a png with a background transparent beacause I want overlay the map on google map.<span class="Apple-converted-space"> </span><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">   I'm using the following scripts but I got a white background</div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">   How can I get a transparent background?<br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">thanks</div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">Francesco<span class="Apple-converted-space"> </span><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""> ;============== open a file ========================================<br class="">   wks = gsn_open_wks(typefile,namefile)<br class=""><br class="">   setvalues NhlGetWorkspaceObjectId()<br class="">      "wsMaximumSize" : 300000000<br class="">   end setvalues<br class=""><br class="">   ;============== miscellanous =======================================<br class="">   gsn_define_colormap(wks,colorsMap)<br class=""><br class="">   ;============== map resources ======================================<br class="">   res = True<br class="">   ;--- Title attributes -----------------------------------<br class="">   res@tiMainFont        = 0<br class="">   res@tiMainPosition    = "Center"<br class="">   res@tiMainFontHeightF = 0.011<br class="">   ;res@tiMainOffsetYF    = 0.01<br class="">   ;--- GSN attributes -------------------------------------<br class="">   res@gsnDraw         = False<br class="">   res@gsnFrame        = False<br class="">   res@gsnMaximize     = True<br class="">   res@gsnAddCyclic    = False   <br class="">   res@gsnSpreadColors = True<br class="">   ;--- Map attributes (window) ----------------------------<br class="">   res@mpLimitMode = "LatLon"    ;Zoom in on the plot area<br class="">   res@mpMinLatF   = minLatF<br class="">   res@mpMaxLatF   = maxLatF<br class="">   res@mpMinLonF   = minLonF<br class="">   res@mpMaxLonF   = maxLonF<br class="">   ;--- Map attributes (projection) ----------------------------<br class="">   res@mpProjection = "mercator"<br class="">   ;--- Map attributes (land outlines) ---------------------<br class="">   res@mpDataBaseVersion = "HighRes"           ;use GMT coastline<br class="">   res@mpOutlineOn       = lmapOutlineOn       ;turn on continental outlines<br class="">   res@mpOutlineBoundarySets = "AllBoundaries" ;turn on country boundaries (all the boundaries database in use)<br class="">   res@mpGeophysicalLineThicknessF = 2.5       ;thickness of outlines<br class="">   res@mpGeophysicalLineColor= "Black"         ;color of cont. outlines<br class="">   res@mpOutlineDrawOrder    = "PostDraw"      ;draw continental outline last<br class="">   res@mpFillOn              = False      ;turn on gray fill for continental background<br class="">   res@pmTickMarkDisplayMode = "Always"<br class="">   ;--- Map attributes (lat/lon grid lines) ----------------<br class="">   res@mpGridAndLimbOn       = False           ;turn on lat/lon lines<br class="">   res@mpGridLineDashPattern = 2               ;... with xxxx lines<br class="">   res@mpGridLineColor       = "black"         ;color of the lines<br class="">   res@mpGridLatSpacingF     = 10              ;space (in degree) between 2 lines<br class="">   res@mpGridLonSpacingF     = 10              ;idem<br class="">   res@mpGridLineThicknessF  = 2.0             ;thickness of the lines<br class="">   res@mpGridAndLimbDrawOrder= "PostDraw"      ;draw lat/lon lines last<br class="">   res@mpLabelFontHeightF    = 0.005           ;label font size<br class="">   ;--- contours attributes --------------------------------<br class="">   res@cnFillOn              = True            ;areas between levels filled with color<br class="">   res@cnFillMode            = "AreaFill"      ;AreaFill<br class="">   res@cnLevelSelectionMode  = "ManualLevels"  ;set manual contour levels<br class="">   res@cnMinLevelValF        = minLevelVal     ;set max contour level<br class="">   res@cnMaxLevelValF        = maxLevelVal     ;set min contour level<br class="">   res@cnLevelSpacingF       = levelSpacing<br class="">   res@cnLinesOn             = False           ;turn off the contour lines<br class="">   res@cnLineLabelsOn        = False           ;turn off the line labels<br class="">   res@cnLineLabelFontHeightF= 0.005<br class="">   res@cnLineLabelDensityF   = 1               ;label spacing when cnLineLabelPlacementMode != "Constant"<br class="">   res@cnLineLabelFontAspectF= 1               ;shape of the line label. > 1 :thinner characters. < 1 :wider<br class="">   res@cnLineLabelInterval   = 1<br class="">   res@cnInfoLabelOn         = False           ;turn off "CONTOUR FROM X TO X BY X" legend.<br class="">   res@cnLabelMasking        = True            ;mask lines where label appear<br class="">   res@cnConstFEnableFill    = True            ;allow constant values (1=sig) to fill<br class="">   res@cnConstFLabelOn       = False<br class="">   ;--- LabelBar attributes --------------------------------<br class="">   res@lbLabelBarOn       = llabbarOn<br class="">   res@lbLabelsOn         = llabbarLabelsOn<br class="">   ;res@lbTitleString      = "("+field@units+")"<br class="">   res@lbOrientation      = "vertical"          ; vertical label bar<br class="">   ;res@pmLabelBarHeightF = 0.7<br class="">   res@lbTitlePosition    = "Bottom"<br class="">   res@lbAutoManage       = False         ; Necessary to control sizes<br class="">   res@pmLabelBarWidthF      = 0.1               ; default is shorter<br class="">   ;res@pmLabelBarHeightF     = 0.1               ; default is taller<br class="">   ;res@lbLabelFontHeightF    = .018              ; default is HUGE<br class="">   res@lbPerimOn             = False             ; default has box<br class="">   res@lbLeftMarginF = 0.0<span class="Apple-converted-space"> </span><br class="">   res@lbTopMarginF = 0.0 ; eliminate any margin at the top and left of the colorbar<br class="">   res@lbBottomMarginF = 0.0 ; eliminate any margin at the top and left of the colorbar<br class="">   res@lbLabelOffsetF = .05 ; this specifies the offset between the colorbar and the labels as a fraction of vpWidthF<span class="Apple-converted-space"> </span><br class="">   res@lbLabelAutoStride = True ; (optional) this ensures that labels do not overlap when the font height is made very large.<br class="">   res@lbLabelFontHeightF = 0.015<br class="">   res@lbTitleFontHeightF = 0.015<br class="">   ;res@lbLabelStride      = 5       ; Label every 5th entry<br class="">   if (ismissing(minLevelVal) .or. ismissing(maxLevelVal)) then res@lbLabelStrings = ""<span class="Apple-converted-space"> </span><br class="">   else res@lbLabelStrings = "" + sprintf(labformatStr,fspan(minLevelVal,maxLevelVal, \<br class="">                                  floattoint((maxLevelVal-minLevelVal)/levelSpacing)+1)) end if<br class="">   <br class="">   ;-------------- scalars attributes ----------------------<br class="">   res@sfXArray = lon2d(0:ny-1,0:nx-1)       ; abscisses<br class="">   res@sfYArray = lat2d(0:ny-1,0:nx-1)       ; ordonnees<br class=""><br class="">   ;=== draw contour/contour lines ====================================<br class="">   plot = gsn_csm_contour_map(wks,field(:,:),res)<br class=""><br class="">   draw(plot)<br class="">   frame(wks)<br class=""><br class="">   system("convert -alpha off -background white -geometry "+typefile@wkWidth+"x"+typefile@wkHeight+ \<br class="">          " -density 300 -trim "+namefile+".png "+namefile+".png")<br class=""><br class=""></div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">ncl-talk mailing list</span><br style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><a href="mailto:ncl-talk@ucar.edu" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">ncl-talk@ucar.edu</a><br style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;" class="">List instructions, subscriber options, unsubscribe:</span><br style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);" class=""></div></blockquote></div><br class=""></div></body></html>