在 Windows 10 上保存为 BMP 文件
我正在尝试将绘图保存到 Windows 10 上的 bmp 文件中。我可以使用交互式终端来完成此操作:windows 或使用 GUI 的 qt。但我不知道如何用命令来做到这一点。这样做只会产生一个空文件。
gnuplot> set terminal windows
Terminal type is now 'windows'
Options are '0 color solid butt enhanced standalone'
gnuplot> set output "file.bmp"
gnuplot> plot sin(x)
Closing file.bmp
I'm trying to save a plot to a bmp file on Windows 10. I can do it with the interactive terminals: windows or qt using the GUI. But I can't figure out how to do it with commands. Doing this just results in an empty file.
gnuplot> set terminal windows
Terminal type is now 'windows'
Options are '0 color solid butt enhanced standalone'
gnuplot> set output "file.bmp"
gnuplot> plot sin(x)
Closing file.bmp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我启动 gnuplot 控制台并
set term windows
并输入plot sin(x)
gnuplot 就会崩溃。这肯定是我的系统(Win10,gnuplot 5.4.1)的一个错误或问题。如果我将终端选项设置为停靠布局1,1
,我只能在不崩溃的情况下进行绘图。但是,我得到了一个像你一样的空 BMP 文件。实际上,到目前为止,我还没有找到任何从 4.4.0 开始的 gnuplot 版本,它似乎能够创建正确的 BMP 输出。
因此,我的建议是创建一个 PNG 输出并将其转换为 BMP,例如通过 ImageMagick。
下载并解压 ImageMagick
的 .zip 版本
仅复制文件
magick.exe
到你的 gnuplot 工作目录(或者你的系统可以找到它的其他地方)将下面的脚本保存到文件
SO71415908.gp
在 Windows 命令行中输入
gnuplot -c SO71415908.gp
,或者在 gnuplot 控制台中输入加载“SO71415908.gp”
。然而,在后一种情况下,我还没有找到如何在不关闭 gnuplot 的情况下关闭 Windows 控制台窗口。脚本:
结果:
两个文件:
SO71415908.png
和SO71415908.bmp
If I start the gnuplot console and
set term windows
and typeplot sin(x)
gnuplot is crashing. This is certainly a bug or something wrong with my system (Win10, gnuplot 5.4.1). I can only plot without crash if I set the terminal option todocked layout 1,1
. But then, I get an empty BMP file like you got.Actually, so far I haven't found any gnuplot version starting from 4.4.0 which seems to be able to create a correct BMP output.
So, then my suggestion would be to create a PNG output and convert this to BMP, e.g. via ImageMagick.
download and unzip the .zip version of ImageMagick
copy only the file
magick.exe
to your gnuplot working directory (or somewhere else where your system can find it)save the script below into the file
SO71415908.gp
either in Windows command line type
gnuplot -c SO71415908.gp
, or alternatively, in gnuplot console typeload "SO71415908.gp"
. However, in the latter case I haven't found out how to close the Windows console windows without closing gnuplot.Script:
Result:
Two files:
SO71415908.png
andSO71415908.bmp