+
    UBiz'              	         ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^RIHt . tR)R R lltR*R R	 llt ! R
 R4      t ! R R]4      t]P$                  R8X  d	   ]! ]4        ! R R]4      t]P$                  R8X  d	   ]! ]4        ! R R]P(                  ]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]P$                  R+9  d   ]P6                  ! R4      '       d	   ]! ]4       ]P6                  ! R4      '       d	   ]! ]4       ]P6                  ! R 4      '       d	   ]! ]4       ]P6                  ! R!4      '       d	   ]! ]4       ]P6                  ! R"4      '       d	   ]! ]4        ! R# R$]4      t ^ R%IHt ]! ]4       ]!R&8X  d   ]"! ]PF                  4      ^8  d   ]$! R'4       ]PJ                  ! 4        ]PL                  ! ]PF                  ^,          4      ;_uu_ 4       t']$! ]! ]'.]PF                  R(,          O5!  4       RRR4       R# R#   ]  d     Li ; i  + '       g   i     R# ; i),    )annotationsNquote)Any)Imagec               $    V ^8  d   QhRRRRRR/# )   viewerztype[Viewer] | ViewerorderintreturnNone )formats   "2/usr/lib/python3.14/site-packages/PIL/ImageShow.py__annotate__r      s"     # #* #3 #t #    c                    \        V \        4      '       d   \        V \        4      '       d   V ! 4       p V^ 8  d   \        P                  V 4       R# \        P                  ^ V 4       R# )a  
The :py:func:`register` function is used to register additional viewers::

    from PIL import ImageShow
    ImageShow.register(MyViewer())  # MyViewer will be used as a last resort
    ImageShow.register(MySecondViewer(), 0)  # MySecondViewer will be prioritised
    ImageShow.register(ImageShow.XVViewer(), 0)  # XVViewer will be prioritised

:param viewer: The viewer to be registered.
:param order:
    Zero or a negative integer to prepend this viewer to the list,
    a positive integer to append it.
N)
isinstancetype
issubclassViewer_viewersappendinsert)r
   r   s   &&r   registerr      sE     &$Jvv$>$>qy6"r   c               (    V ^8  d   QhRRRRRRRR/# )	r	   imageImage.Imagetitle
str | Noneoptionsr   r   boolr   )r   s   "r   r   r   3   s(       J # $ r   c                \    \          F!  pVP                  ! V 3RV/VB '       g   K    R# 	  R# )z
Display a given image.

:param image: An image object.
:param title: Optional title. Not all viewers can display the title.
:param \**options: Additional viewer options.
:returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
r    TF)r   show)r   r    r"   r
   s   &&, r   r%   r%   3   s/     ;;u5E5W55  r   c                      ] tR t^Bt$ RtR R ltRtR]R&    / tR]R&    R	 R
 lt	R R lt
R R ltR R ltR R ltRtR# )r   zBase class for viewers.c               $    V ^8  d   QhRRRRRR/# r	   r   r   r"   r   r   r   r   )r   s   "r   r   Viewer.__annotate__G   s!     1 1+ 1# 1# 1r   c                   VP                   R9   ge   V P                  R8X  d   VP                   R9   gC   \        P                  ! VP                   4      pVP                   V8w  d   VP	                  V4      pV P
                  ! V3/ VB # )zk
The main function for displaying an image.
Converts the given image to the target format and displays it.
PNG)1RGBA)zI;16LA)moder   r   getmodebaseconvert
show_image)selfr   r"   bases   &&, r   r%   Viewer.showG   si     JJ-'u$~)E$$UZZ0DzzT!d+u000r   Nr!   r   zdict[str, Any]r"   c                    V ^8  d   QhRRRR/# )r	   r   r   r   r!   r   )r   s   "r   r   r)   ^   s       
 r   c                    V P                   # )z3Return format name, or ``None`` to save as PGM/PPM.)r   r3   r   s   &&r   
get_formatViewer.get_format^   s    {{r   c               $    V ^8  d   QhRRRRRR/# r	   filestrr"   r   r   r   )r   s   "r   r   r)   b   s!     ' ' ' ' 'r   c                    Rp\        V4      h)zR
Returns the command used to display the file.
Not implemented in the base class.
zunavailable in base viewer)NotImplementedError)r3   r=   r"   msgs   &&, r   get_commandViewer.get_commandb   s    
 +!#&&r   c                    V ^8  d   QhRRRR/# )r	   r   r   r   r>   r   )r   s   "r   r   r)   j   s     J J J Jr   c                \    VP                   ! RRV P                  V4      /V P                  B # )z+Save to temporary file and return filename.r   r   )_dumpr9   r"   r8   s   &&r   
save_imageViewer.save_imagej   s&    {{I$//%"8IDLLIIr   c               $    V ^8  d   QhRRRRRR/# r(   r   )r   s   "r   r   r)   n   s&     A A A A Ar   c                F    V P                   ! V P                  V4      3/ VB # )zDisplay the given image.)	show_filerG   r3   r   r"   s   &&,r   r2   Viewer.show_imagen   s    ~~dooe4@@@r   c               $    V ^8  d   QhRRRRRR/# r	   pathr>   r"   r   r   r   r   )r   s   "r   r   r)   r   !      c c c r   c                    \         P                  P                  V4      '       g   \        h\         P                  ! V P
                  ! V3/ VB 4       ^# )
Display given file.
)osrP   existsFileNotFoundErrorsystemrB   r3   rP   r"   s   &&,r   rK   Viewer.show_filer   s<     ww~~d####
		$""43734r   r   )__name__
__module____qualname____firstlineno____doc__r%   r   __annotations__r"   r9   rB   rG   r2   rK   __static_attributes__r   r   r   r   r   B   sF    !1$ FJ/ G^ 7'JA r   r   c                  B    ] tR t^tRtRtR^RR/tR R ltR R	 ltR
t	R# )WindowsViewerzNThe default viewer on Windows is the default system application for PNG files.r+   compress_levelsave_allTc               $    V ^8  d   QhRRRRRR/# r<   r   )r   s   "r   r   WindowsViewer.__annotate__   s!     
 
 
 
 
r   c                	    R V RV R2# )zstart "Pillow" /WAIT "z)" && ping -n 4 127.0.0.1 >NUL && del /f ""r   r3   r=   r"   s   &&,r   rB   WindowsViewer.get_command   s    $TF +q"	
r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   rf      s!      c c c r   c                    \         P                  P                  V4      '       g   \        h\        P
                  ! V P                  ! V3/ VB R\        \        R4      R7       ^# )rS   TCREATE_NO_WINDOW)shellcreationflags)rT   rP   rU   rV   
subprocessPopenrB   getattrrX   s   &&,r   rK   WindowsViewer.show_file   sQ     ww~~d####T-W-!*.@A	

 r   r   N
rZ   r[   r\   r]   r^   r   r"   rB   rK   r`   r   r   r   rb   rb      s'    XFJ5G
 r   rb   win32c                  B    ] tR t^tRtRtR^RR/tR R ltR R	 ltR
t	R# )	MacViewerz2The default viewer on macOS using ``Preview.app``.r+   rc   rd   Tc               $    V ^8  d   QhRRRRRR/# r<   r   )r   s   "r   r   MacViewer.__annotate__   s!         r   c                	F    R pRV R\        V4       R\        V4       R2pV# )zopen -a Preview.app( z; sleep 20; rm -f z)&r   r3   r=   r"   commands   &&, r   rB   MacViewer.get_command   s1     (gYad},>uT{m2Nr   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   ry      s!      c c c r   c                   \         P                  P                  V4      '       g   \        h\        P
                  ! RRRV.4       \        \        RR4      ;'       d    \        \        R4      pV'       * ;'       d    \        P                  ;'       g    \        P                  ! R4      pV'       d   \        P                  ! VRR	V.4       ^# )
rS   openz-azPreview.appfrozenF_MEIPASSpython3z-cz<import os, sys, time; time.sleep(20); os.remove(sys.argv[1]))rT   rP   rU   rV   rp   callrr   syshasattr
executableshutilwhichrq   )r3   rP   r"   pyinstallerr   s   &&,  r   rK   MacViewer.show_file   s     ww~~d####}d;<c8U3PPZ8P%o88#..TTV\\)=T
R	 r   r   Nrt   r   r   r   rw   rw      s'    <FJ5G r   rw   darwinc                  \    ] tR t^tRtR^RR/t]P                  R R l4       tR R lt	R	t
R
# )
UnixViewerr+   rc   rd   Tc               $    V ^8  d   QhRRRRRR/# r	   r=   r>   r"   r   r   tuple[str, str]r   )r   s   "r   r   UnixViewer.__annotate__   s!      3 3 ? r   c                	    R # Nr   ri   s   &&,r   get_command_exUnixViewer.get_command_ex   s    r   c               $    V ^8  d   QhRRRRRR/# r<   r   )r   s   "r   r   r      s!     * * * * *r   c                	V    V P                   ! V3/ VB ^ ,          pV R\        V4       2# )r   r|   )r   r   r}   s   &&, r   rB   UnixViewer.get_command   s1    %%d6g6q9!E$K=))r   r   N)rZ   r[   r\   r]   r   r"   abcabstractmethodr   rB   r`   r   r   r   r   r      s7    FJ5G * *r   r   c                  2    ] tR t^tRtR R ltR R ltRtR# )	XDGViewerz+
The freedesktop.org ``xdg-open`` command.
c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   XDGViewer.__annotate__   s!     # #3 #3 #? #r   c                	    R ;r4W43# )xdg-openr   )r3   r=   r"   r~   r   s   &&,  r   r   XDGViewer.get_command_ex   s    ))""r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   r      rQ   r   c                    \         P                  P                  V4      '       g   \        h\        P
                  ! RV.4       ^# )rS   r   rT   rP   rU   rV   rp   rq   rX   s   &&,r   rK   XDGViewer.show_file   s3     ww~~d####*d+,r   r   NrZ   r[   r\   r]   r^   r   rK   r`   r   r   r   r   r      s    # r   r   c                  6    ] tR t^tRtRR R lltR R ltRtR# )	DisplayViewerzT
The ImageMagick ``display`` command.
This viewer supports the ``title`` parameter.
Nc               (    V ^8  d   QhRRRRRRRR/# 	r	   r=   r>   r    r!   r"   r   r   r   r   )r   s   "r   r   DisplayViewer.__annotate__   s,     # ## *#>A#	#r   c                	H    R ;rEV'       d   VR\        V4       2,          pWE3# )displayz -title r   r3   r=   r    r"   r~   r   s   &&&,  r   r   DisplayViewer.get_command_ex   s-      )(%,00G""r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   r      !      c c c r   c                    \         P                  P                  V4      '       g   \        hR.pVP	                  R4      pV'       d   VRV.,          pVP                  V4       \        P                  ! V4       ^# )rS   r   r    z-titlerT   rP   rU   rV   getr   rp   rq   r3   rP   r"   argsr    s   &&,  r   rK   DisplayViewer.show_file   sa     ww~~d####{G$Xu%%DDr   r   r   r   r   r   r   r   r      s    
# r   r   c                  2    ] tR tRtRtR R ltR R ltRtR# )	GmDisplayVieweri  z*The GraphicsMagick ``gm display`` command.c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   GmDisplayViewer.__annotate__  !     # #3 #3 #? #r   c                	    R pRpWC3# )gmz
gm displayr   r3   r=   r"   r   r~   s   &&,  r   r   GmDisplayViewer.get_command_ex  s    
""r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   r     rQ   r   c                    \         P                  P                  V4      '       g   \        h\        P
                  ! RRV.4       ^# )rS   r   r   r   rX   s   &&,r   rK   GmDisplayViewer.show_file  s5     ww~~d####$	401r   r   Nr   r   r   r   r   r     s    4#
 r   r   c                  2    ] tR tRtRtR R ltR R ltRtR# )		EogVieweri  z'The GNOME Image Viewer ``eog`` command.c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   EogViewer.__annotate__  r   r   c                	    R pRpWC3# )eogzeog -nr   r   s   &&,  r   r   EogViewer.get_command_ex  s    
""r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   r     rQ   r   c                    \         P                  P                  V4      '       g   \        h\        P
                  ! RRV.4       ^# )rS   r   z-nr   rX   s   &&,r   rK   EogViewer.show_file  s5     ww~~d####%t,-r   r   Nr   r   r   r   r   r     s    1#
 r   r   c                  6    ] tR tRtRtR	R R lltR R ltRtR# )
XVVieweri'  zL
The X Viewer ``xv`` command.
This viewer supports the ``title`` parameter.
Nc               (    V ^8  d   QhRRRRRRRR/# r   r   )r   s   "r   r   XVViewer.__annotate__-  s,     # ## *#>A#	#r   c                	H    R ;rEV'       d   VR\        V4       2,          pWE3# )xvz -name r   r   s   &&&,  r   r   XVViewer.get_command_ex-  s-    
  $#u//G""r   c               $    V ^8  d   QhRRRRRR/# rO   r   )r   s   "r   r   r   7  r   r   c                    \         P                  P                  V4      '       g   \        hR.pVP	                  R4      pV'       d   VRV.,          pVP                  V4       \        P                  ! V4       ^# )rS   r   r    z-namer   r   s   &&,  r   rK   XVViewer.show_file7  sa     ww~~d####vG$We$$DDr   r   r   r   r   r   r   r   r   '  s    
# r   r   r   r   r   r   r   c                  &    ] tR tRtRtR R ltRtR# )IPythonVieweriT  z!The viewer for IPython frontends.c               $    V ^8  d   QhRRRRRR/# r(   r   )r   s   "r   r   IPythonViewer.__annotate__W  s!         r   c                	    \        V4       ^#    )ipython_displayrL   s   &&,r   r2   IPythonViewer.show_imageW  s    r   r   N)rZ   r[   r\   r]   r^   r2   r`   r   r   r   r   r   T  s    + r   r   )r   __main__z.Syntax: python3 ImageShow.py imagefile [title]:r	   NNr   r   )ru   r   )(
__future__r   r   rT   r   rp   r   shlexr   typingr    r   r   r   r%   r   rb   platformrw   ABCr   r   r   r   r   r   r   r   IPython.displayr   r   ImportErrorrZ   lenargvprintexitr   imr   r   r   <module>r      s   # 
 	   
   #,7 7zF 6 <<7]   F <<8Y
*& 
*
 &J <j $
 $z @ <<**||J||I||D!||E||DF : ] z
388}q>?
	CHHQK	 	 Bd2%%& 
!	    		 
!	 	 s   H9 "I9III	