许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  去除Visual Paradigm输出图片中的水印(浮水印)的方法

去除Visual Paradigm输出图片中的水印(浮水印)的方法

阅读数 5
点赞 0
article_banner


BoUML都收费了,argoUML半年没更新了,而startUML六年多没更新了,免费的UML工具里就数VP的社区版还不错了。唯一的缺憾就是输出图片有浮水印,虽说咱们也四处宣传VP,但输出的图片实在不方便。VP 9已经将浮水印贴满整个背景,影响导出图片的可读性。

不过,SVG导出功能还在!(这是我唯一还在坚持VP的理由!) 我写了一段脚本,帮助去除VP输出SVG图片中的浮水印,并转成PNG。这个PNG转换的功能依赖于Inkscape,没有的话去SourceForge.net下吧。 注意安装后要把Inkscape的安装路径放在PATH中去。

Inkscape支持命令行,如下:

 inkscape -f srcSVGFile -e tgtPNGFile -d 150  (d后面的dpi值,150基本可以适用于放到PPT讲解用了. 其它参数用--help就可以看了)

脚本也简单,就是把SVG文件的某个特定的浮水印字符去除,然后呼叫inkscape转换下就可以了。支持单个文件转换或者一个目录下所有文件转换,还算方便吧。

#!/usr/bin/python# coding: utf-8#/*!#@brief Description# A simple utility to remove watermark for SVG files exported by VP 9.0 ~ VP 12.x#*/import os,sys,string,datetime,copy,re srcSVGString = ["Visual Paradigm for UML Enterprise Edition [evaluation copy]",	"Visual Paradigm for UML Community Edition [not for commercial use]",	"Visual Paradigm for UML Modeler Edition [evaluation copy]"]pathInkSpace = "/Applications/Inkscape.app/Contents/Resources/bin/inkscape"	def replaceStringInNewFile(srcFile):	file=open(srcFile, "r") 	if None==file:		print "Could not open for %s updating" %srcFile		return -1		allLines=file.readlines()	file.close()	index = 0			for eachLine in allLines:				for srcString in srcSVGString:			if 0<=string.find(eachLine,srcString):				allLines[index] = eachLine.replace(srcString,' ')				break				index = index+1					file = open(srcFile,"w")	file.writelines(allLines)	file.close()		return 0 def convertSVGToPNG(filename):		fileStr, extStr = os.path.splitext(filename)		if 0 == replaceStringInNewFile(filename):			convertCmd=pathInkSpace+" -f\""+filename+"\" -e \""+fileStr+".png\" -d 150";			return os.system(convertCmd)			else:			return -1						def convertAllSVNInFolder(srcFolder):	if not os.path.isdir( srcFolder ):		return -1		paths = os.listdir( srcFolder )	for path in paths:		filePath = os.path.join( srcFolder, path )		if filePath[-4:].lower() == ".svg":			convertSVGToPNG(filePath)		return 0	# Main entry if __name__ =="__main__":	print 'Please ensure the Inkscape has been installed,'	print ' and put the installed folder in the PATH!' 		if len(sys.argv) < 2:		print '\tUsage: '		print '\t python svgconvert.py sourceSVGFile or'		print '\t python svgconvert.py svnFolder'		print ' '	elif os.path.isdir(sys.argv[1]):		convertAllSVNInFolder(sys.argv[1])	else:		convertSVGToPNG(sys.argv[1])		print '\nFinished! Enjoy the conversation result! '	print 'If you have any comment, pls mail to'	print '\t horky.chen@gmail.com'	print ''




免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删


相关文章
技术文档
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空