+
    ?i59                         R t ^ RIt^RIHtHt ^RIHt ^RIH	t	H
t
HtHt  ! R R]4      t ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]4      tR# )ag  Read/Write images using FreeImage.

Backend Library: `FreeImage <https://freeimage.sourceforge.io/>`_

.. note::
    To use this plugin you have to install its backend::

        imageio_download_bin freeimage

    or you can download the backend using the function::

        imageio.plugins.freeimage.download()

Each Freeimage format has the ``flags`` keyword argument. See the `Freeimage
documentation <https://freeimage.sourceforge.io/>`_ for more information.

Parameters
----------
flags : int
    A freeimage-specific option. In most cases we provide explicit
    parameters for influencing image reading.

N)Formatimage_as_uint)RETURN_BYTES)FNAME_PER_PLATFORMIO_FLAGSdownloadfic                      a a ] tR t^%t oRtRtRRR/V 3R lllt]R 4       tR t	R t
 ! R	 R
]P                  4      t ! R R]P                  4      tRtVtV ;t# )FreeimageFormatz$See :mod:`imageio.plugins.freeimage`iNfifc               6   < \         SV `  WW4R 7       WPn        R# ))
extensionsmodesN)super__init___fif)selfnamedescriptionr   r   r   	__class__s   &&&&&$W/var/www/html/photoedit/myenv/lib/python3.14/site-packages/imageio/plugins/freeimage.pyr   FreeimageFormat.__init__*   s    zO	    c                    V P                   # Nr   r   s   &r   r   FreeimageFormat.fif.   s    yyr   c                ~   \         P                  ! 4       '       d   \        VR 4      '       g3    \         P                  ! VP                  RVP
                  4      Vn        VP                  V P                  8X  d   R# VP                  ^8X  d   V P                  ^8X  d   R# R# R# R#   \         d    RTn         L[i ; i)r   rTN)	r   has_libhasattrgetFIFfilename
firstbytesr   	Exceptionr   r   requests   &&r   	_can_readFreeimageFormat._can_read2   s    ::<<7F++&#%99W-=-=sGDVDV#WGL ||txx'"txx2~  (6"  ! &#%GL&s   1B' 'B<;B<c                j   \         P                  ! 4       '       dX   \        VR 4      '       g(    \         P                  ! VP                  R4      Vn        VP
                  V P                  J d   R# R# R#   \         d3    TP                  \        8X  d   T P                  Tn         LSRTn         L\i ; i)r   wTNr!   )
r   r"   r#   r$   r%   r   
ValueErrorraw_urir   r   r(   s   &&r   
_can_writeFreeimageFormat._can_writeA   s    ::<<7F++*#%99W-=-=s#CGL ||txx' (  " *,6'+xx')	*s   &A5 51B2(B21B2c                   B   a  ] tR t^Qt o R tRR ltR tR tR tRt	V t
R# )	FreeimageFormat.Readerc                    ^# )    r   s   &r   _get_length"FreeimageFormat.Reader._get_lengthR   s    r   c                    \         P                  ! V P                  P                  V P                  P
                  V4      V n        V P                  P                  V P                  P                  4       4       R # r   )	r   create_bitmapr)   r%   formatr   _bmload_from_filenameget_local_filenamer   flagss   &&r   _openFreeimageFormat.Reader._openU   sJ    ''(=(=t{{PUVDHHH''(G(G(IJr   c                :    V P                   P                  4        R # r   )r<   closer   s   &r   _closeFreeimageFormat.Reader._closeY   s    HHNNr   c                    V^ 8w  d   \        R4      hV P                  P                  4       V P                  P                  4       3# )    z+This format only supports singleton images.)
IndexErrorr<   get_image_dataget_meta_datar   indexs   &&r   	_get_data FreeimageFormat.Reader._get_data\   s:    z !NOO88**,dhh.D.D.FFFr   c                `    Ve   V^ 8X  g   \        4       hV P                  P                  4       # r   )rI   r<   rK   rL   s   &&r   _get_meta_data%FreeimageFormat.Reader._get_meta_dataa   s(    MUaZ l"88))++r   r<   NrH   )__name__
__module____qualname____firstlineno__r7   rA   rE   rN   rQ   __static_attributes____classdictcell____classdict__s   @r   Readerr3   Q   s%     		K		G
	, 	,r   r]   c                   <   a  ] tR t^ht o RR ltR tR tR tRtV t	R# )FreeimageFormat.Writerc                <    Wn         R V n        RV n        / V n        R # )NF)_flagsr<   _is_set_metar?   s   &&r   rA   FreeimageFormat.Writer._openi   s    KDH DLDJr   c                    V P                   P                  V P                  4       V P                   P                  V P                  P                  4       4       V P                   P                  4        R # r   )r<   set_meta_datarc   save_to_filenamer)   r>   rD   r   s   &r   rE   FreeimageFormat.Writer._closeo   sE    HH""4::.HH%%dll&E&E&GHHHNNr   c                   V P                   '       g	   R V n         M\        R4      hVP                  ^8X  d"   VP                  R,          ^8X  d
   VR,          pV P                  fk   \
        P                  ! V P                  P                  V P                  P                  V P                  4      V n        V P                  P                  V4       V P                  P                  V4       W n        R# )Tz1Singleton image; can only append image data once.Nr!   )NNNrj   rH   )rb   RuntimeErrorndimshaper<   r   r:   r)   r%   r;   r   ra   allocateset_image_datarc   r   immetas   &&&r   _append_data#FreeimageFormat.Writer._append_datav   s    <<<#"J  ww!| 1[xx++LL))4;;??DKK !!"%HH##B' Jr   c                    Wn         R # r   )rc   )r   rr   s   &&r   _set_meta_data%FreeimageFormat.Writer._set_meta_data   s    Jr   )r<   ra   rb   rc   NrT   )
rU   rV   rW   rX   rA   rE   rs   rv   rY   rZ   r[   s   @r   Writerr_   h   s     			.	 	r   rx   r   )NN)rU   rV   rW   rX   __doc___modesr   propertyr   r*   r0   r   r]   rx   rY   rZ   __classcell__)r   r\   s   @@r   r
   r
   %   sa     .Fd     , ,.& & &r   r
   c                   D    ] tR t^tRt ! R R]P                  4      tRtR# )FreeimageBmpFormataz  A BMP format based on the Freeimage library.

This format supports grayscale, RGB and RGBA images.

The freeimage plugin requires a `freeimage` binary. If this binary
not available on the system, it can be downloaded manually from
<https://github.com/imageio/imageio-binaries> by either

- the command line script ``imageio_download_bin freeimage``
- the Python method ``imageio.plugins.freeimage.download()``

Parameters for saving
---------------------
compression : bool
    Whether to compress the bitmap using RLE when saving. Default False.
    It seems this does not always work, but who cares, you should use
    PNG anyway.

c                   0   a  ] tR t^t o RR ltR tRtV tR# )FreeimageBmpFormat.Writerc                    \        V4      pV'       d   V\        P                  ,          pMV\        P                  ,          p\        P
                  P                  W4      # r   )intr   BMP_SAVE_RLEBMP_DEFAULTr
   rx   rA   )r   r@   compressions   &&&r   rA   FreeimageBmpFormat.Writer._open   sE    JE...---"))//<<r   c                \    \        V^R7      p\        P                  P                  WV4      # )   bitdepth)r   r
   rx   rs   rp   s   &&&r   rs   &FreeimageBmpFormat.Writer._append_data   s'    rA.B"))66tFFr   r6   N)rH   FrU   rV   rW   rX   rA   rs   rY   rZ   r[   s   @r   rx   r      s     	=	G 	Gr   rx   r6   NrU   rV   rW   rX   ry   r
   rx   rY   r6   r   r   r~   r~      s!    (G'' G Gr   r~   c                   n    ] tR t^tRt ! R R]P                  4      t ! R R]P                  4      tRtR# )FreeimagePngFormata  A PNG format based on the Freeimage library.

This format supports grayscale, RGB and RGBA images.

The freeimage plugin requires a `freeimage` binary. If this binary
not available on the system, it can be downloaded manually from
<https://github.com/imageio/imageio-binaries> by either

- the command line script ``imageio_download_bin freeimage``
- the Python method ``imageio.plugins.freeimage.download()``

Parameters for reading
----------------------
ignoregamma : bool
    Avoid gamma correction. Default True.

Parameters for saving
---------------------
compression : {0, 1, 6, 9}
    The compression factor. Higher factors result in more
    compression at the cost of speed. Note that PNG compression is
    always lossless. Default 9.
quantize : int
    If specified, turn the given RGB or RGBA image in a paletted image
    for more efficient storage. The value should be between 2 and 256.
    If the value of 0 the image is not quantized.
interlaced : bool
    Save using Adam7 interlacing. Default False.
c                   *   a  ] tR t^t o RR ltRtV tR# )FreeimagePngFormat.Readerc                    \        V4      pV'       d   V\        P                  ,          p\        P                  P                  W4      # r   )r   r   PNG_IGNOREGAMMAr
   r]   rA   )r   r@   ignoregammas   &&&r   rA   FreeimagePngFormat.Reader._open   s5    JE111"))//<<r   r6   NrH   TrU   rV   rW   rX   rA   rY   rZ   r[   s   @r   r]   r           	= 	=r   r]   c                   0   a  ] tR t^t o RR ltR tRtV tR# )FreeimagePngFormat.Writerc                l   ^ \         P                  ^\         P                  ^\         P                  ^	\         P                  /p\        V4      pV'       d   V\         P                  ,          p WV,          ,          p\        P                  P                  Y4      #   \         d    \        R4      hi ; i)rH   z&Png compression must be 0, 1, 6, or 9.)r   PNG_Z_NO_COMPRESSIONPNG_Z_BEST_SPEEDPNG_Z_DEFAULT_COMPRESSIONPNG_Z_BEST_COMPRESSIONr   PNG_INTERLACEDKeyErrorr.   r
   rx   rA   )r   r@   r   quantize
interlacedcompression_maps   &&&&& r   rA   FreeimagePngFormat.Writer._open   s    8008,,855822	O JE000K55 #))//<<  K !IJJKs   .B B3c                4   \        VP                  4      R 8X  d   \        V^R7      pM\        V^R7      p\        P                  P                  WV4       \        V P                  P                  P                  RR4      4      pV'       g   R# VP                  ^8X  d   VP                  R,          ^8X  g   \        R4      hV^8  g   VR8  d   \        R4      hV P                  P                  ^ V4      pV P                  P                  4        W@n        R# )	uint16r   r   FzCan only quantize RGB images   z!PNG quantize param must be 2..256Nr!   )strdtyper   r
   rx   rs   r   r)   kwargsgetrl   rm   r.   r<   r   rD   )r   rq   rr   qbms   &&&  r   rs   &FreeimagePngFormat.Writer._append_data   s    288}("23"22""//$?DLL''++J>?Agglrxx|q'8 !?@@Q!c' !DEEXX&&q!, r   rS   N)rH   	   rH   Fr   r[   s   @r   rx   r      s     	=$	 	r   rx   r6   N	rU   rV   rW   rX   ry   r
   r]   rx   rY   r6   r   r   r   r      s0    <='' =$'' $ $r   r   c                   n    ] tR tRtRt ! R R]P                  4      t ! R R]P                  4      tRtR# )	FreeimageJpegFormati  a  A JPEG format based on the Freeimage library.

This format supports grayscale and RGB images.

The freeimage plugin requires a `freeimage` binary. If this binary
not available on the system, it can be downloaded manually from
<https://github.com/imageio/imageio-binaries> by either

- the command line script ``imageio_download_bin freeimage``
- the Python method ``imageio.plugins.freeimage.download()``

Parameters for reading
----------------------
exifrotate : bool
    Automatically rotate the image according to the exif flag.
    Default True. If 2 is given, do the rotation in Python instead
    of freeimage.
quickread : bool
    Read the image more quickly, at the expense of quality.
    Default False.

Parameters for saving
---------------------
quality : scalar
    The compression factor of the saved image (1..100), higher
    numbers result in higher quality but larger file size. Default 75.
progressive : bool
    Save as a progressive JPEG file (e.g. for images on the web).
    Default False.
optimize : bool
    On saving, compute optimal Huffman coding tables (can reduce a
    few percent of file size). Default False.
baseline : bool
    Save basic JPEG, without metadata or any markers. Default False.

c                   6   a  ] tR tRt o RR ltR tR tRtV tR# )FreeimageJpegFormat.Readeri3  c                    \        V4      pV'       d   V^8w  d   V\        P                  ,          pV'       g   V\        P                  ,          p\        P
                  P                  W4      # )   )r   r   JPEG_EXIFROTATEJPEG_ACCURATEr
   r]   rA   )r   r@   
exifrotate	quickreads   &&&&r   rA    FreeimageJpegFormat.Reader._open4  sN    JEjAo111///"))//<<r   c                l    \         P                  P                  W4      w  r#V P                  W#4      pW#3# r   )r
   r]   rN   _rotate)r   rM   rq   rr   s   &&  r   rN   $FreeimageJpegFormat.Reader._get_data>  s/    &--77DHBb'B8Or   c                   V P                   P                  P                  RR4      ^8X  d    VR,          R,          pVR9   d    VR9   d   \        P                  ! V^4      pVR9   d   \        P                  ! V^4      pVR9   d   \        P                  ! V4      pVR	9   d   \        P
                  ! V4      pV# V#   \         d     T# i ; i)
a  Use Orientation information from EXIF meta data to
orient the image correctly. Freeimage is also supposed to
support that, and I am pretty sure it once did, but now it
does not, so let's just do it in Python.
Edit: and now it works again, just leave in place as a fallback.
r   N	EXIF_MAINOrientation)r5   r   )      )      )   r   )r   r   r   r   )r)   r   r   nprot90fliplrr   )r   rq   rr   oris   &&& r   r   "FreeimageJpegFormat.Reader._rotateC  s     ||""&&|T:a?+{+M:C
 f}f}XXb!_f}XXb!_f}XXb\l*YYr]I2I    Is   B? ?CCr6   N)rH   TF)	rU   rV   rW   rX   rA   rN   r   rY   rZ   r[   s   @r   r]   r   3  s     	=	
	 	r   r]   c                   0   a  ] tR tRt o RR ltR tRtV tR# )FreeimageJpegFormat.Writeri_  c                h   \        V4      pV^8  g   V^d8  d   \        R4      h\        V4      pW,          pV'       d   V\        P                  ,          pV'       d   V\        P                  ,          pV'       d   V\        P
                  ,          p\        P                  P                  W4      # )r5   z)JPEG quality should be between 1 and 100.)	r   r.   r   JPEG_PROGRESSIVEJPEG_OPTIMIZEJPEG_BASELINEr
   rx   rA   )r   r@   qualityprogressiveoptimizebaselines   &&&&&&r   rA    FreeimageJpegFormat.Writer._open`  s     'lG{gm !LMMJEE222//////"))//<<r   c                    VP                   ^8X  d$   VP                  R,          ^8X  d   \        R4      h\        V^R7      p\        P
                  P                  WV4      # )r   z$JPEG does not support alpha channel.r   r!   )rl   rm   IOErrorr   r
   rx   rs   rp   s   &&&r   rs   'FreeimageJpegFormat.Writer._append_datas  sM    ww!| 1DEErA.B"))66tFFr   r6   N)rH   K   FFFr   r[   s   @r   rx   r   _  s     	=&	G 	Gr   rx   r6   Nr   r6   r   r   r   r     s5    #J('' (XG'' G Gr   r   c                   D    ] tR tRtRt ! R R]P                  4      tRtR# )FreeimagePnmFormatiz  a<  A PNM format based on the Freeimage library.

This format supports single bit (PBM), grayscale (PGM) and RGB (PPM)
images, even with ASCII or binary coding.

The freeimage plugin requires a `freeimage` binary. If this binary
not available on the system, it can be downloaded manually from
<https://github.com/imageio/imageio-binaries> by either

- the command line script ``imageio_download_bin freeimage``
- the Python method ``imageio.plugins.freeimage.download()``

Parameters for saving
---------------------
use_ascii : bool
    Save with ASCII coding. Default True.
c                   *   a  ] tR tRt o RR ltRtV tR# )FreeimagePnmFormat.Writeri  c                    \        V4      pV'       d   V\        P                  ,          p\        P                  P                  W4      # r   )r   r   PNM_SAVE_ASCIIr
   rx   rA   )r   r@   	use_asciis   &&&r   rA   FreeimagePnmFormat.Writer._open  s5    JE000"))//<<r   r6   Nr   r   r[   s   @r   rx   r     r   r   rx   r6   Nr   r6   r   r   r   r   z  s    $='' = =r   r   )ry   numpyr   corer   r   core.requestr   
_freeimager   r   r   r   r
   r~   r   r   r   r6   r   r   <module>r      se   0  ( ' B B
if id"G "GJN NbjG/ jGZ= =r   