Displaying images in a console application?
I have a console application where the screen is dumping 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 is the best way to display two images while running a console application? I guess I would use some kind of interprocess communication to send information back and forth, but I'm not sure exactly how I would do it well.
Also, I prefer NOT to store images in files if possible. There is no reason to save data, and if the console application terminates unexpectedly, it’s better if I don’t have any dirt on the filesystem.
Does anyone have any thoughts on how to do this?
source to share
I'm not sure I understand the concern. You should be able to conditionally pop up either SwingJFrame
or AWTFrame
from your console application, am I wrong?
source to share
You can use for example. BufferedImage to create images, or a utility 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 regular Java GUI stuff, either Swing or AWT. Start the GUI on a separate thread if the console part needs to continue processing while the images are displayed.
The Working with Images tutorial may contain some useful examples.
source to share