
    a                         d Z ddlZddlZ	 ddlmZ n$# e$ r 	 ddlmZ n# e$ r	 ddlmZ Y nw xY wY nw xY wddZedk    r ej	         e                       dS dS )zhPrint or replace ImageDescription in first page of TIFF file.

Usage: tiffcomment [--set comment] file

    N   )tiffcommentc                 d   | t           j        } t          |           dk    r| d         dv r| d         }| dd         }nd}| dd         }t          |          dk    st          d |D                       r6t	                       t	          t
                                                     dS |nt          j        	                    |          r=t          |d          5 }|                                }ddd           n# 1 swxY w Y   nR	 |                    d	          }n;# t          $ r.}t	          |            |                                }Y d}~nd}~ww xY w|D ]O}	 t          ||          }|rt	          |           %# t          $ r}t	          | d
|            Y d}~Hd}~ww xY wdS )z-Tiffcomment command line usage main function.N   r   z--set   r   c              3   @   K   | ]}|                     d           V  dS )-N)
startswith).0fs     4lib/python3.11/site-packages/tifffile/tiffcomment.py	<genexpr>zmain.<locals>.<genexpr>"   s.      ??Aall3//??????    rbasciiz: )sysargvlenanyprint__doc__stripospathexistsopenreadencodeUnicodeEncodeErrorr   	Exception)r   commentfilesfhexcfileresults          r   mainr'      s   |x
4yy1}}aG++q'QRRQRR
5zzQ#???????gmmoo		 	  ''4   	 BggiiG	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 	'nnW--GG! 	' 	' 	'S(OOOnn&&GGGGGG	'   	 w//F  f	  	$ 	$ 	$T""S""########	$ sB   D  DDD# #
E-$EE#F
F-F((F-__main__)N)
r   r   r   tifffiler   ImportErrortifffile.tifffiler'   __name__exit r   r   <module>r/      s     
			 



)%%%%%%% ) ) ))1111111 ) ) )(((((((())$ $ $ $N zCHTTVV s$    4 4.4.44