+
    ^eòjE  ã                  ó–   € R t ^ RIHt ^ RIt^ RI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	 lt ! R
 R4      tR# )z¡Provides objects that can characterize image streams.

That characterization is as to content type and size, as a required step in including
them in a document.
)ÚannotationsN)ÚIOÚTuple)ÚUnrecognizedImageError)ÚEmuÚInchesÚLengthÚlazypropertyc                  ób  a € ] tR t^tRtR V 3R llt]R R l4       t]R R l4       t]	R 4       t
]	R	 R
 l4       t]R 4       t]	R 4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       tRR R llt]R 4       t]R R R ll4       tRtV ;t# )!ÚImagezcGraphical image stream such as JPEG, PNG, or GIF with properties and methods
required by ImagePart.c               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚblobÚbytesÚfilenameÚstrÚimage_headerÚBaseImageHeader© )Úformats   "Ú‡/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/docx/image/image.pyÚ__annotate__ÚImage.__annotate__   s!   € ÷ *ñ *˜Uð *¨cð *Àñ *ó    c                	óP   <€ \         \        V `  4        Wn        W n        W0n        R # ©N)Úsuperr   Ú__init__Ú_blobÚ	_filenameÚ_image_header)Úselfr   r   r   Ú	__class__s   &&&&€r   r   ÚImage.__init__   s    ø€ ÜŒe�TÑ#Ô%ØŒ
Ø!ŒØ)Ör   c               ó    € V ^8„  d   QhRRRR/# )r   r   r   Úreturnr   r   )r   s   "r   r   r      s   € ÷ .ñ .˜Uð . uñ .r   c                óP   € \         P                  ! V4      pV P                  W!4      # )zXReturn a new |Image| subclass instance parsed from the image binary contained
in `blob`.)ÚioÚBytesIOÚ_from_stream)Úclsr   Ústreams   && r   Ú	from_blobÚImage.from_blob   s#   € ô —’˜DÓ!ˆØ×Ñ Ó-Ð-r   c               ó   € V ^8„  d   QhRR/# )r   Úimage_descriptorzstr | IO[bytes]r   )r   s   "r   r   r   $   s   € ÷ 8ñ 8¨ñ 8r   c                óŽ  € \        V\        4      '       df   Tp\        VR4      ;_uu_ 4       pVP                  4       p\        P
                  ! V4      pRRR4       \        P                  P                  V4      pM%TpVP                  ^ 4       VP                  4       pRpV P                  XXV4      #   + '       g   i     Lh; i)zReturn a new |Image| subclass instance loaded from the image file identified
by `image_descriptor`, a path or file-like object.ÚrbN)Ú
isinstancer   ÚopenÚreadr'   r(   ÚosÚpathÚbasenameÚseekr)   )r*   r/   r6   Úfr   r+   r   s   &&     r   Ú	from_fileÚImage.from_file#   s˜   € ô Ð&¬×,Ò,Ø#ˆDÜ�d˜D×!Ô! QØ—v‘v“x�ÜŸš DÓ)�÷ "ô —w‘w×'Ñ'¨Ó-‰Hà%ˆFØ�K‰K˜ŒNØ—;‘;“=ˆDØˆHØ×Ñ ¨¨hÓ7Ð7÷ "×!ús   ­'B4Â4C	c                ó   € V P                   # )zThe bytes of the image 'file'.)r   ©r!   s   &r   r   Ú
Image.blob4   s   € ð �z‰zÐr   c               ó   € V ^8„  d   QhRR/# ©r   r%   r   r   )r   s   "r   r   r   :   s   € ÷ /ñ /˜cñ /r   c                ó.   € V P                   P                  # )zIMIME content type for this image, e.g. ``'image/jpeg'`` for a JPEG image.)r    Úcontent_typer=   s   &r   rB   ÚImage.content_type9   s   € ð ×!Ñ!×.Ñ.Ð.r   c                óp   € \         P                  P                  V P                  4      ^,          R,          # )zæThe file extension for the image.

If an actual one is available from a load filename it is used. Otherwise a
canonical extension is assigned based on the content type. Does not contain the
leading period, e.g. 'jpg', not '.jpg'.
:é   NN)r5   r6   Úsplitextr   r=   s   &r   ÚextÚ	Image.ext>   s'   € ô �w‰w×Ñ §¡Ó/°Õ2°2Õ6Ð6r   c                ó   € V P                   # )zhOriginal image file name, if loaded from disk, or a generic filename if
loaded from an anonymous stream.)r   r=   s   &r   r   ÚImage.filenameH   s   € ð �~‰~Ðr   c               ó   € V ^8„  d   QhRR/# ©r   r%   Úintr   )r   s   "r   r   r   O   s   € ÷ +ñ +˜#ñ +r   c                ó.   € V P                   P                  # ©z,The horizontal pixel dimension of the image.)r    Úpx_widthr=   s   &r   rP   ÚImage.px_widthN   s   € ð ×!Ñ!×*Ñ*Ð*r   c               ó   € V ^8„  d   QhRR/# rL   r   )r   s   "r   r   r   T   s   € ÷ ,ñ ,˜3ñ ,r   c                ó.   € V P                   P                  # ©z*The vertical pixel dimension of the image.)r    Ú	px_heightr=   s   &r   rU   ÚImage.px_heightS   s   € ð ×!Ñ!×+Ñ+Ð+r   c               ó   € V ^8„  d   QhRR/# rL   r   )r   s   "r   r   r   Y   ó   € ÷ +ñ +˜#ñ +r   c                ó.   € V P                   P                  # ©zwInteger dots per inch for the width of this image.

Defaults to 72 when not present in the file, as is often the case.
)r    Úhorz_dpir=   s   &r   r[   ÚImage.horz_dpiX   ó   € ð ×!Ñ!×*Ñ*Ð*r   c               ó   € V ^8„  d   QhRR/# rL   r   )r   s   "r   r   r   a   rX   r   c                ó.   € V P                   P                  # ©zxInteger dots per inch for the height of this image.

Defaults to 72 when not present in the file, as is often the case.
)r    Úvert_dpir=   s   &r   ra   ÚImage.vert_dpi`   r]   r   c               ó   € V ^8„  d   QhRR/# ©r   r%   r   r   )r   s   "r   r   r   i   s   € ÷ 5ñ 5�vñ 5r   c                óN   € \        V P                  V P                  ,          4      # )zuA |Length| value representing the native width of the image, calculated from
the values of `px_width` and `horz_dpi`.)r   rP   r[   r=   s   &r   ÚwidthÚImage.widthh   s   € ô �d—m‘m d§m¡mÕ3Ó4Ð4r   c               ó   € V ^8„  d   QhRR/# rd   r   )r   s   "r   r   r   o   s   € ÷ 6ñ 6˜ñ 6r   c                óN   € \        V P                  V P                  ,          4      # )zwA |Length| value representing the native height of the image, calculated from
the values of `px_height` and `vert_dpi`.)r   rU   ra   r=   s   &r   ÚheightÚImage.heightn   s   € ô �d—n‘n t§}¡}Õ4Ó5Ð5r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rf   zint | Length | Nonerj   r%   zTuple[Length, Length]r   )r   s   "r   r   r   t   s$   € ÷ 'ñ 'Ø(ð'Ø9Lð'à	ñ'r   c                óŽ  € Vf   Vf   V P                   V P                  3# VfH   Vf   Q h\        V4      \        V P                  4      ,          p\        V P                   V,          4      pVfB   \        V4      \        V P                   4      ,          p\        V P                  V,          4      p\	        V4      \	        V4      3# )aç  (cx, cy) pair representing scaled dimensions of this image.

The native dimensions of the image are scaled by applying the following rules to
the `width` and `height` arguments.

* If both `width` and `height` are specified, the return value is (`width`,
`height`); no scaling is performed.
* If only one is specified, it is used to compute a scaling factor that is then
applied to the unspecified dimension, preserving the aspect ratio of the image.
* If both `width` and `height` are |None|, the native dimensions are returned.

The native dimensions are calculated using the dots-per-inch (dpi) value
embedded in the image, defaulting to 72 dpi if no value is specified, as is
often the case. The returned values are both |Length| objects.
)rf   rj   ÚfloatÚroundr   )r!   rf   rj   Úscaling_factors   &&& r   Úscaled_dimensionsÚImage.scaled_dimensionst   s�   € ð$ Š=˜Vš^Ø—:‘:˜tŸ{™{Ð*Ð*àŠ=ØÒ%Ð%Ð%Ü" 6›]¬U°4·;±;Ó-?Õ?ˆNÜ˜$Ÿ*™* ~Õ5Ó6ˆEàŠ>Ü" 5›\¬E°$·*±*Ó,=Õ=ˆNÜ˜4Ÿ;™;¨Õ7Ó8ˆFä�5‹zœ3˜v›;Ð&Ð&r   c                ó^   € \         P                  ! V P                  4      P                  4       # )z#SHA1 hash digest of the image blob.)ÚhashlibÚsha1r   Ú	hexdigestr=   s   &r   ru   Ú
Image.sha1”   s    € ô �|Š|˜DŸJ™JÓ'×1Ñ1Ó3Ð3r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r+   ú	IO[bytes]r   r   r   z
str | Noner%   r   r   )r   s   "r   r   r   š   s2   € ÷ 1ñ 1àð1ð ð1ð ð	1ð
 
ñ1r   c                óX   € \        V4      pVf   RVP                  ,          pV ! W#V4      # )z`Return an instance of the |Image| subclass corresponding to the format of the
image in `stream`.zimage.%s)Ú_ImageHeaderFactoryÚdefault_ext)r*   r+   r   r   r   s   &&&& r   r)   ÚImage._from_stream™   s1   € ô +¨6Ó2ˆØÒØ! L×$<Ñ$<Õ<ˆHÙ�4 <Ó0Ð0r   )r   r   r    )NNr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úclassmethodr,   r:   Úpropertyr   rB   r	   rG   r   rP   rU   r[   ra   rf   rj   rq   ru   r)   Ú__static_attributes__Ú__classcell__)r"   s   @r   r   r      s0  ø† ñ÷*ð *ð ô.ó ð.ð ô8ó ð8ð  ñó ðð ô/ó ð/ð ñ7ó ð7ð ñó ðð
 ô+ó ð+ð ô,ó ð,ð ô+ó ð+ð ô+ó ð+ð ô5ó ð5ð
 ô6ó ð6÷
'ð@ ñ4ó ð4ð ö1ó ö1r   r   c               ó   € V ^8„  d   QhRR/# ©r   r+   ry   r   )r   s   "r   r   r   ¨   s   € ÷ !ñ ! 	ñ !r   c                ó¬   € ^ RI Hp R R lpV! V 4      pV F5  w  rEpV\        V4      ,           pW5V pW†8X  g   K$  VP                  V 4      u # 	  \        h)zRA |BaseImageHeader| subclass instance that can parse headers of image in `stream`.)Ú
SIGNATURESc               ó   € V ^8„  d   QhRR/# rˆ   r   )r   s   "r   r   Ú)_ImageHeaderFactory.<locals>.__annotate__¬   s   € ÷ ñ ˜	ñ r   c                óF   € V P                  ^ 4       V P                  ^ 4      # )é    )r8   r4   )r+   s   &r   Úread_32Ú$_ImageHeaderFactory.<locals>.read_32¬   s   € Ø�‰�AŒØ�{‰{˜2‹Ðr   )Ú
docx.imagerŠ   ÚlenÚfrom_streamr   )	r+   rŠ   r�   Úheaderr*   ÚoffsetÚsignature_bytesÚendÚfound_bytess	   &        r   r{   r{   ¨   sZ   € å%õñ �V‹_€FÛ(2Ñ$ˆ�_Ø”s˜?Ó+Õ+ˆØ CÐ(ˆØÖ)Ø—?‘? 6Ó*Ò*ñ	 )3ô
 !Ð r   c                  ó’   € ] tR t^¹tRtR R lt]R R l4       t]R R l4       t]R 4       t	]R	 4       t
]R
 4       t]R 4       tRtR# )r   z>Base class for image header subclasses like |Jpeg| and |Tiff|.c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rP   rM   rU   r[   ra   r   )r   s   "r   r   ÚBaseImageHeader.__annotate__¼   s(   € ÷ "ñ " ð "°ð "Àð "Èsñ "r   c                	ó6   € Wn         W n        W0n        W@n        R # r   )Ú	_px_widthÚ
_px_heightÚ	_horz_dpiÚ	_vert_dpi)r!   rP   rU   r[   ra   s   &&&&&r   r   ÚBaseImageHeader.__init__¼   s   € Ø!ŒØ#ŒØ!ŒØ!Žr   c               ó   € V ^8„  d   QhRR/# r@   r   )r   s   "r   r   r›   Ã   s   € ÷ 'ñ '˜cñ 'r   c                ó   € Rp\        V4      h)zDAbstract property definition, must be implemented by all subclasses.zNcontent_type property must be implemented by all subclasses of BaseImageHeader©ÚNotImplementedError)r!   Úmsgs   & r   rB   ÚBaseImageHeader.content_typeÂ   s   € ð _ˆÜ! #Ó&Ð&r   c               ó   € V ^8„  d   QhRR/# r@   r   )r   s   "r   r   r›   É   s   € ÷ 
ñ 
˜Sñ 
r   c                ó   € \        R4      h)z}Default filename extension for images of this type.

An abstract property definition, must be implemented by all subclasses.
zMdefault_ext property must be implemented by all subclasses of BaseImageHeaderr¤   r=   s   &r   r|   ÚBaseImageHeader.default_extÈ   s   € ô "Ø[ó
ð 	
r   c                ó   € V P                   # rO   )r�   r=   s   &r   rP   ÚBaseImageHeader.px_widthÒ   s   € ð �~‰~Ðr   c                ó   € V P                   # rT   )rž   r=   s   &r   rU   ÚBaseImageHeader.px_height×   s   € ð �‰Ðr   c                ó   € V P                   # rZ   )rŸ   r=   s   &r   r[   ÚBaseImageHeader.horz_dpiÜ   ó   € ð �~‰~Ðr   c                ó   € V P                   # r`   )r    r=   s   &r   ra   ÚBaseImageHeader.vert_dpiä   r±   r   )rŸ   rž   r�   r    N)r~   r   r€   r�   r‚   r   r„   rB   r|   rP   rU   r[   ra   r…   r   r   r   r   r   ¹   s‚   † ÙHõ"ð ô'ó ð'ð
 ô
ó ð
ð ñó ðð ñó ðð ñó ðð ñó ôr   r   )r‚   Ú
__future__r   rt   r'   r5   Útypingr   r   Údocx.image.exceptionsr   Údocx.sharedr   r   r   r	   r   r{   r   r   r   r   Ú<module>r¸      s@   ðñõ #ã Û 	Û 	ß å 8ß 9Ó 9÷S1ñ S1õl!÷"1ó 1r   