How to close after PIL.image show of python

python opens the default photo viewer after PIL.image show. Is there a way to close it. Or can only end the process

Mar.31,2021

can take a handle snapshot of all hwnd windows before show. Then a snapshot comparison is made after show. You can also use lower-level WIN32 hooks to monitor window changes.


pillow does not provide a method to close.

according to the PIL document https://pillow.readthedocs.io.

and source code

if sys.platform == "win32":

    class WindowsViewer(Viewer):
        format = "BMP"

        def get_command(self, file, **options):
            return ('start "Pillow" /WAIT "%s" '
                    '&& ping -n 2 127.0.0.1 >NUL '
                    '&& del /f "%s"' % (file, file))

    register(WindowsViewer)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bac0-2c2a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bac0-2c2a6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?