B
    |b	              	   @   s   d Z ddlmZ ddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlmZmZ dZdd
dZedkreejdk redejd eejd Zy"e	edZee W dQ R X W n$ ek
r   edeejd Y nX dS )a  :mod:`wand.display` --- Displaying images
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The :func:`display()` functions shows you the image.  It is useful for
debugging.

If you are in Mac, the image will be opened by your default image application
(:program:`Preview.app` usually).

If you are in Windows, the image will be opened by :program:`imdisplay.exe`,
or your default image application (:program:`Windows Photo Viewer` usually)
if :program:`imdisplay.exe` is unavailable.

You can use it from CLI also.  Execute :mod:`wand.display` module through
:option:`python -m <-m>` option:

.. sourcecode:: console

   $ python -m wand.display wandtests/assets/mona-lisa.jpg

.. versionadded:: 0.1.9

    )print_functionN   )Image)library)	BlobErrorDelegateError)display:0c             C   s   t | tstdt|  t }|dkrTy| jdd W n tk
rN   Y nX dS |dkrd| j	  }|dkrvd	}t
j|d
}| j|d t|dkrdnd|  n&tjtjgtj_t| jt|  dS )a  Displays the passed ``image``.

    :param image: an image to display
    :type image: :class:`~wand.image.Image`
    :param server_name: X11 server name to use.  it is ignored and not used
                        for Mac.  default is ``':0'``
    :type server_name: :class:`str`

    z/image must be a wand.image.Image instance, not Windowszwin:.)filenameN)r
   Darwin.)ZmiffZxcZpng)suffixzstart zopen )
isinstancer   	TypeErrorreprplatformsystemsaver   formatlowertempfilemktemposctypesc_void_pc_char_pr   ZMagickDisplayImageargtypesZwandstrencode)imageZserver_namer   extpath r#   O/home/ankuromar296_gmail_com/.local/lib/python3.7/site-packages/wand/display.pyr   &   s(    

r   __main__   z"usage: python -m wand.display FILE)file)r   zcannot read the file)r	   )__doc__
__future__r   r   r   r   sysr   r    r   apir   
exceptionsr   r   __all__r   __name__lenargvprintstderr
SystemExitr"   r#   r#   r#   r$   <module>   s*   
"
