在控制台应用程序中显示图像?

发布于 2024-08-28 21:14:31 字数 235 浏览 1 评论 0原文

我有一个控制台应用程序,它会在屏幕上抓取一些数据,现在我需要进行图像比较。如果图像不同,我想向用户显示图像。在控制台应用程序执行期间显示两个图像的最佳方式是什么?我假设我会使用某种进程间通信来来回发送信息,但我不确定我到底会如何以良好的方式做到这一点。

另外,如果可能的话,我宁愿不将图像存储到文件中。没有理由保留数据,如果控制台应用程序意外终止,最好不要在文件系统上留下任何污垢。

有谁对如何最好地实现这一目标有任何想法?

I have a console application which screen scrapes some data, and now I need to do image comparisons. If the images are different, I want to show the images to the user. What's the best way to display two images during the execution of a console application? I'm assuming I would use some sort of inter-process communication to send information back and forth, but I'm not sure how exactly I would go about doing that in a good fashion.

Also, I'd rather NOT store the images to files if possible. There's no reason to persist the data, and if the console application terminates unexpectedly, it's better if I don't have any dirt left on the file system.

Does anyone have any thoughts on how best to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

合久必婚 2024-09-04 21:14:31

我不确定我是否理解这种担忧。您应该完全能够有条件地弹出 Swing JFrameAWT Frame< /code>来自您的控制台应用程序,我错了吗?

I am not sure I understand the concern. You should be perfectly able to conditionally pop up either a Swing JFrame or AWT Frame from your console application, am I wrong?

失去的东西太少 2024-09-04 21:14:31

您可以使用例如 BufferedImage 来构造图像,或 javax.imageio 中的实用程序 如果您的图像已经采用某种常见格式(例如 PNG、JPEG、BMP)。至于向用户显示,只需使用常规的 Java GUI 东西,Swing 或 AWT。如果控制台部分需要在显示图像时继续处理,请在单独的线程中运行 GUI。

使用图像教程可能包含一些有用的示例。

You can use e.g. BufferedImage to construct images, or the utilities in javax.imageio if your image is already in some common format (e.g. PNG, JPEG, BMP). As for displaying to the user, just use the regular Java GUI stuff, either Swing or AWT. Run the GUI in a separate thread if the console part needs to keep processing while the images are being displayed.

The Working with Images tutorial may contain some helpful examples.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文