# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + [markdown] slideshow={"slide_type": "slide"}
# # Installation
#
# ```shell
# python -m pip install requests
# conda install -c conda-forge ipyleaflet ipywidgets
# ```

# + slideshow={"slide_type": "slide"}
from IPython.display import Image

# + slideshow={"slide_type": "fragment"}
url="http://www.hausgazette.org/py/img/IMG_0939-small.JPG"

# + slideshow={"slide_type": "fragment"}
Image(url)

# + slideshow={"slide_type": "slide"}
import requests
r = requests.get(url)
r.status_code

# + slideshow={"slide_type": "fragment"}
rawdata = r.content
Image(data=rawdata)

# + slideshow={"slide_type": "slide"}
from PIL import Image as PImage
import io
im = PImage.open(io.BytesIO(rawdata))

# + slideshow={"slide_type": "fragment"}
im

# + slideshow={"slide_type": "slide"}
print(im.format, "{}x{} {}".format(*im.size, im.mode))

# + slideshow={"slide_type": "fragment"}
thumb_size = (256,256)
im.thumbnail(thumb_size)

# + slideshow={"slide_type": "fragment"}
im

# + slideshow={"slide_type": "fragment"}
print(im.format, "{}x{} {}".format(*im.size, im.mode))

# + slideshow={"slide_type": "slide"}
rot_im = im.rotate(270, expand=1)
rot_im

# + slideshow={"slide_type": "slide"}
from ImageMetaData import ImageMetaData
meta_data = ImageMetaData(im)

# + slideshow={"slide_type": "fragment"}
exif_data = meta_data.get_exif_data()
exif_data

# + slideshow={"slide_type": "slide"}
latlng = meta_data.get_lat_lng()
print(latlng)

# + slideshow={"slide_type": "slide"}
# #!conda install -c conda-forge ipyleaflet
# #!conda install -c conda-forge ipywidgets

# + slideshow={"slide_type": "fragment"}
from ipyleaflet import ( Map, Marker )
from IPython.display import display

# + slideshow={"slide_type": "slide"}
# show map
center = (52.5, 13.3) #latlng
zoom = 100
m = Map(center=center, zoom=zoom)
mark = Marker(location=m.center)
m += mark
mark.interact(opacity=(0.0,1.0,0.01))
display(m)

# + slideshow={"slide_type": "slide"}


StarcoderdataJupyterScriptsDedupFiltered