a
    d;                     @   s*   d dl Z ddlT d dlmZ dddZdS )    N   )*)_webpc           	      C   s  d}| dd dkr| }d}n| dd dkrH| dd	 d
krH| }d}npt | d}| }W d   n1 sp0    Y  d}|dd dkrd}n$|dd dkr|dd	 d
krd}|dkrt|}t|}|r||d}n|}nV|dkr>zt|}W n< ty   |}Y n& ty<   t	tj
 tdY n0 t|tjrb|| |d n|rt |d}|| W d   n1 s0    Y  nF|rt | d}|| W d   n1 s0    Y  ntddS )zj
    py:function:: piexif.remove(filename)

    Remove exif from JPEG.

    :param str filename: JPEG
    Fr      s   Zjpeg   s   RIFF      s   WEBPZwebprbNT    zError occurred.zwb+z1Give a second argument to 'remove' to output file)openreadZsplit_into_segmentsZget_exif_segreplacer   remove
ValueErroreprintargs
isinstanceioBytesIOwriteseek)	srcZnew_fileZoutput_is_fileZsrc_data	file_typefsegmentsZexifZnew_data r   W/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/piexif/_remove.pyr      sL     & 


,,r   )N)r   _commonZpiexifr   r   r   r   r   r   <module>   s   