- Timestamp:
- Apr 11, 2020, 1:27:16 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r2780 r2812 2703 2703 return colorvc 2704 2704 2705 def output_kind(kindf, namef, close ):2705 def output_kind(kindf, namef, close, quality=90): 2706 2706 """ Function to generate the output of the figure 2707 2707 kindf= kind of the output … … 2710 2710 namef= name of the figure (without extension) 2711 2711 close= if the graph has to be close or not [True/False] 2712 quality= quality of the plot for 'convert' (90, default) 2712 2713 """ 2714 # resizing by number of pixels: http://www.imagemagick.org/Usage/resize/#pixel 2715 # convert topo_10k.png -resize 3300000@ topo_10k.eps 2713 2716 import subprocess as sub 2714 2717 fname = 'output_kind' 2715 2718 2716 availkindf = ['eps', 'gif', 'jpg', 'png', 'pdf-png', 'ps'] 2719 qS = str(quality) 2720 2721 availkindf = ['eps', 'gif', 'jpg', 'png', 'pdf-eps', 'pdf-png', 'ps'] 2717 2722 2718 2723 if kindf == 'h': … … 2740 2745 plt.savefig(namef + ".png") 2741 2746 if close: print "Successfully generation of figure '" + namef + ".png' !!!" 2747 elif kindf == 'pdf-eps': 2748 plt.savefig(namef + ".pdf") 2749 sub.call('convert -trim -density 300 ' + namef + '.pdf -quality '+ qS + \ 2750 ' '+ namef+'.eps', shell=True) 2751 sub.call('rm ' + namef + '.pdf', shell=True) 2752 if close: print "Successfully generation of figure '" + namef + ".png' !!!" 2742 2753 elif kindf == 'pdf-png': 2743 2754 plt.savefig(namef + ".pdf") 2744 sub.call('convert -trim -density 300 ' + namef + '.pdf -quality 90 '+\2745 namef+'.png', shell=True)2755 sub.call('convert -trim -density 300 ' + namef + '.pdf -quality ' + qS + \ 2756 ' ' + namef+'.png', shell=True) 2746 2757 sub.call('rm ' + namef + '.pdf', shell=True) 2747 2758 if close: print "Successfully generation of figure '" + namef + ".png' !!!" … … 14906 14917 14907 14918 if kfig == 'pdf-png': kfigS = 'png' 14919 elif kfig == 'pdf-eps': kfigS = 'eps' 14908 14920 else: kfigS = kfig 14909 14921
Note: See TracChangeset
for help on using the changeset viewer.