+
    Ci                     :   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIt^RI	H
t
 ^RIHt ^RIHt ]P                  ! RRR7      ]P                   ! R	R
R]P"                  ! ]4      RRRR7      ]P                   ! RRRRRR7      ]P                   ! RR^]RRR7      ]P                   ! RR^
]RRR7      ]P                   ! RR^
]RRR7      ]P                   ! RRRRRR7      ]P                   ! R R!RRR"R7      ]P                   ! R#R$R2]]]]3^R%R&7      ]P                   ! R'R(]R)7      ]P                   ! R*R+]R,R-7      ]P(                  ! R.]R)7      ]P(                  ! R/]R)7      R0 R1 l4       4       4       4       4       4       4       4       4       4       4       4       4       tR# )3    N)IO)remove)new_session)sessions_namesbzfor a byte stream as input)namehelpz-mz--modelu2netTz
model name)defaulttypeshow_defaultshow_choicesr	   z-az--alpha-mattingzuse alpha matting)is_flagr   r	   z-afz$--alpha-matting-foreground-thresholdztrimap fg threshold)r   r   r   r	   z-abz$--alpha-matting-background-thresholdztrimap bg thresholdz-aez--alpha-matting-erode-sizez
erode sizez-omz--only-maskzoutput only the maskz-ppmz--post-process-maskzpost process the maskz-bgcz	--bgcolorzABackground color (R G B A) to replace the removed background with)r   r   nargsr	   z-xz--extras)r   z-oz--output_specifierzCprintf-style specifier for output filenames (e.g. 'output-%d.png')))r   r	   image_widthimage_heightc                X    V ^8  d   QhR\         R\         R\        R\        R\         RR/# )   modelextrasr   r   output_specifierreturnN)strint)formats   "V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/rembg/commands/b_command.py__annotate__r   a   sL     Q QQQ Q 	Q
 Q 
Q    c                  aaaaaa	a
a V'       d'    SP                  \        P                  ! V4      4       \        V 3/ SB oSS,          ^,          oS'       d   \        P                  P                  \        P                  P                  \        P                  P                  S4      4      4      p\        P                  P                  V4      '       g   \        P                  ! VRR7       R R lo
R o	VV	VVV
VVV3R lp\        P                  ! V! 4       4       R#   \         d    \        P
                  ! R4      hi ; i)	a  
Command-line interface for processing images by removing the background using a specified model and generating a mask.

This CLI command takes several options and arguments to configure the background removal process and save the processed images.

Parameters:
    model (str): The name of the model to use for background removal.
    extras (str): Additional options in JSON format that can be passed to customize the background removal process.
    image_width (int): The width of the input images in pixels.
    image_height (int): The height of the input images in pixels.
    output_specifier (str): A printf-style specifier for the output filenames. If specified, the processed images will be saved to the specified output directory with filenames generated using the specifier.
    **kwargs: Additional keyword arguments that can be used to customize the background removal process.

Returns:
    None
z"extras must be a valid JSON stringT)exist_okc                X    V ^8  d   QhR\         P                  P                  R\        /# )r   imgr   )PILImagebytes)r   s   "r   r   b_command.<locals>.__annotate__   s"      syy 5 r   c                 r    \         P                  ! 4       pV P                  VR R7       VP                  4       # )PNGr   )ioBytesIOsavegetvalue)r"   buffs   & r   img_to_byte_array$b_command.<locals>.img_to_byte_array   s)    zz|e$}}r   c                    a"   \         P                  ! 4       p \         P                  ! 4       p\         P                  ! V4      oV P	                  V3R  l\
        P                  4      G Rj  xL
  V P                  \         P                  P                  \
        P                  4      G Rj  xL
 w  r#\         P                  ! W#W4      pW3#  L` L"5i)c                     < S # )N )protocols   r   <lambda>9b_command.<locals>.connect_stdin_stdout.<locals>.<lambda>   s    Xr   N)asyncioget_event_loopStreamReaderStreamReaderProtocolconnect_read_pipesysstdinconnect_write_pipestreamsFlowControlMixinstdoutStreamWriter)loopreaderw_transport
w_protocolwriterr4   s        @r   connect_stdin_stdout'b_command.<locals>.connect_stdin_stdout   s     %%'%%'//7$$%5syyAAA(,(?(?OO,,cjj)
 #
 %%kvL~ 	B#
s$   A(C+C,?C+C,!CCc                    <"   S! 4       G R j  xL
 w  r^ p  V P                  S4      G R j  xL
 pV'       g   R # \        P                  P                  RS	S3V4      p\	        V3RS/SB pS'       d   VP                  SV,          RR7       MVP                  S
! V4      4       V^,          pK   L L  \        P                   d     R # i ; i5i)NRGBsessionr(   r)   )	readexactlyr#   r$   	frombytesr   r,   writer7   IncompleteReadError)rD   rG   idx	img_bytesr"   outputbytes_per_imgrH   r   r   r/   kwargsr   rL   s         r   mainb_command.<locals>.main   s     355"("4"4]"CC	 ii))%+|1LiX?W??#KK!1C!7KGLL!26!:;q# 6
 D .. sM   CB2	CB6 B4B6 CA4B6 0C4B6 6CCCCN)updatejsonloads	ExceptionclickBadParameterr   ospathdirnameabspath
expanduserisdirmakedirsr7   run)r   r   r   r   r   rU   
output_dirrV   rT   rH   r/   rL   s   &&fffl  @@@@r   	b_commandrg      s    R 	KMM$**V,- %*6*G,.2MWW__GGOOBGG../?@A

 ww}}Z((KK
T2
 , KKm  	K$$%IJJ	Ks   %D$ $"E)r   r   r   r   )r7   r*   rY   r^   r<   typingr   r\   r#   bgr   session_factoryr   sessionsr   commandoptionChoicer   r   argumentrg   r3   r   r   <module>rp      s    	  	 
   
  ) % 		% 	n	%	 	 	*		 	*		 	 		 		 
	  

sC	
	L dJS)		N	 	 	Q		 *	bQr   