HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/zopfli/__pycache__/png.cpython-310.pyc
o

we7�@s:ddlZddlmZdgZddd�Zedkre�dSdS)�N)�png_optimize�optimizecCs�ddl}ddl}|jdd�}|�d�|�d�|jdddd	d
�|jdddd
d�|jddddd�|jdddd
�|jdddd
�|jdddd
�|jddddd�|jddtdd�|jd d!d"d#�|jd$d%d&�d'd(�|�|�}|jrytnd)d&�}|jdur�|j}}nd*\}}|j	r�|d+9}|d+9}t
|jd,��}|��}	Wd�n1s�wY|d-|j���t
|	|j|j|j|j|j|j||d.�	}
t|	�}|d/|�d0|d1�d2��t|
�}t||d3d4�}
|d5|�d0|d1�d6|
�d7��||k�r|d8�n||k�r|d9�n|j�r|d:�n|d;�|	}
|j�s;|j�|j��r;td<|j�d=������d>k�r;dSt
|jd?��}|�|
�Wd�dS1�sSwYdS)@Nrzpython -m zopfli.png)�prog�infile�outfilez-vz	--verbose�
store_truezprint more info)�action�helpz-m�
compress_morez<compress more: use more iterations (depending on file size).)r�destr	z-y�	overwritez#do not ask about overwriting files.)rrr	z--lossy_transparentz;remove colors behind alpha channel 0. No visual difference.z--lossy_8bitz6convert 16-bit per channel image to 8-bit per channel.z--always_zopflifyzHalways output the image encoded by Zopfli, even if bigger than original.z-q�
use_zopfli�store_falsez*use quick, but not very good, compression.z--iterationsz�number of iterations, more iterations makes it slower but provides slightly better compression. Default: 15 for small files, 5 for large files.)�default�typer	z	--filters�filter_strategiesa�filter strategies to try: 0-4: give all scanlines PNG filter type 0-4; m: minimum sum; e: entropy; p: predefined (keep from input, this likely overlaps another strategy); b: brute force (experimental). By default, if this argument is not given, one that is most likely the best for this image is chosen by trying faster compression with each type. If this argument is used, all given filter types are tried with slow compression and the best result retained. A good set of filters to try is --filters=0me.)rr	z--keepchunkscSs
|�d�S)N�,)�split)�s�r�C/home/arjun/projects/env/lib/python3.10/site-packages/zopfli/png.py�<lambda>Ls
zmain.<locals>.<lambda>a�keep metadata chunks with these names that would normally be removed, e.g. tEXt,zTXt,iTXt,gAMA, ... Due to adding extra data, this increases the result size. Keeping bKGD or sBIT chunks may cause additional worse compression due to forcing a certain color type, it is advised to not keep these for web images because web browsers do not use these chunks. By default ZopfliPNG only keeps (and losslessly modifies) the following chunks because they are essential: IHDR, PLTE, tRNS, IDAT and IEND.)rr	cWsdS�Nr)�_rrrrZs)����rbzOptimizing )�verbose�lossy_transparent�
lossy_8bitr�
keepchunksr
�num_iterations�num_iterations_largezInput size: z (izK)�d�z
Result size: zK). Percentage of original: �%zResult is smallerzResult has exact same sizezOriginal was smallerz,Preserving original PNG since it was smallerzFile z exists, overwrite? (y/N)
�y�wb)�argparse�os�ArgumentParser�add_argument�int�
parse_argsr�print�
iterationsr
�openr�readrrr rr!r
�len�round�always_zopflifyr�path�isfiler�input�strip�lower�write)�argsr)r*�parser�options�logr"r#�f�	input_png�
result_png�
input_size�result_size�
percentagerrr�mains�

�������	��


����




���$�rF�__main__r)�zopfli�
zopfli.zopflirr�__all__rF�__name__rrrr�<module>s

�