简体   繁体   中英

Image Magick++ close .display() Popup window by command

in documentation of Magick++ I found the command to display an image

Image temp_image(my_image);temp_image.display(); // display 'my_image' in a pop-up window

this works quite well, but I can find a command to close this window by code.

My goal is to open a window with the image, give image new name by commandline input, then automatically close the window, and show next image to rename.

Although the new popup-window sets the "active window" to it's self. For entering some input to command line (eg new_name), I have to click again at the terminal window.

My (pseudo)code at the moment:

for(all_images){temp_image.display(); renaming_method();}

just now I have to close the upcoming window manualy by hand, better would be something like

for(all_images){temp_image.display(); renaming_method(); temp_image.display_close();}

do you have any ideas how to do this?

Magick++, and ImageMagick, doesn't have any methods to manage active display windows. You can roll your own XWindow method, but most projects I've seen just do the following routine...

  • Write temporary image
  • Ask OS to open temporary file by forking a process & calling xdg-open , open , or start commands (depending on OS).
  • Send SIGINT to pid when user wishes to close child process.
  • Clean-up any resources

Not ideal, but will get you roughly there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM