如何保存除PostScript之外的Plotchart画布而不显示它? [英] How to save Plotchart canvas other than PostScript without displaying it?

查看:66
本文介绍了如何保存除PostScript之外的Plotchart画布而不显示它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了其他输出格式部分。 ://tcllib.sourceforge.net/doc/plotchart.html rel = nofollow>图解表文档,但仍然不知道该怎么做。

I read the section OTHER OUTPUT FORMATS of Plotchart documentation, but still can't figure out how to do it.

我要:


  1. 将画布另存为图像而不显示。所以我可以以批处理模式运行它。

  2. 以其他格式保存。 (例如:jpeg,png ...)

不妨举一个简单的例子。

A brief example is appreciated.

推荐答案

我发现 Img 库能够转换Postscript转换成各种格式,并且一种不显示的快速而肮脏的方式是画布立即运行退出

I found Img library is capable to converts Postscript into various formats, and a quick and dirty way do not display the canvas is to run exit immediately.

这里是一个示例:

package require Plotchart
package require Img

canvas .c -background white -width 400 -height 200
pack   .c -fill both

set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}]

foreach {x y} {0.0 32.0 10.0 50.0 25.0 60.0 78.0 11.0 } {
    $s plot series1 $x $y
}

$s title "Data series"

set file "test.ps"
$s saveplot $file
set root [file rootname $file]

set image [image create photo -file $file]
foreach {f suffix} {JPEG jpg GIF gif PNG png} {
    $image write $root.$suffix -format $f
}

exit

这篇关于如何保存除PostScript之外的Plotchart画布而不显示它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆