
    h                     2    d dl Z d dlmZ d dlmZ ddZd Zy)    N)BytesIO)utilsc                     ddl m}m} | syt        | j	                               } |j                  |       }	 d|_        |j                          d|_        |rt        j                  |      }|S # d|_        w xY w)z
    Try to open the source file directly using PIL, ignoring any errors.

    exif_orientation

        If EXIF orientation data is present, perform any required reorientation
        before passing the data along the processing pipeline.

    r   )Image	ImageFileNTF)
PILr   r   r   readopenLOAD_TRUNCATED_IMAGESloadr   exif_orientation)sourcer   optionsr   r   images         Q/home/dcms/DCMS/lib/python3.12/site-packages/easy_thumbnails/source_generators.py	pil_imager      sm     %V[[]#FJJvE0*.	'

*/	'&&u-L	 +0	's   A. .	A7c                     	 ddl m} | sy	 |j                  | j                        S # t        $ r#}t        j                  d| d       Y d}~yd}~ww xY w# t        $ r}|d}~ww xY w)zN
    Try to open the source file directly using VIL, ignoring any errors.
    r   )r   z,Could not import VIL for SVG image support: .N)easy_thumbnails.VILr   ImportErrorwarningswarnr   file	Exception)r   r   r   ieexcs        r   	vil_imager   (   sk    -
 zz&++&&  DRDJK  	s+   ' A 	AAA	A&A!!A&)T)r   ior   easy_thumbnailsr   r   r        r   <module>r"      s      !Br!   