mapbox / rio-rgbify

Encoded arbitrary bit depth rasters in pseudo base-256
MIT License
101 stars 38 forks source link

Use Rasterio to create webp #23

Open vincentsarago opened 5 years ago

vincentsarago commented 5 years ago

in https://github.com/mapbox/rio-rgbify/blob/31bd65b175938a4362e0e8bf1d3b86d5e8d31e5b/rio_rgbify/mbtiler.py#L46-L69 we use Pillow to save the image as webp. Since rasterio ~1.0.9 , rasterio wheels are shipped with Webp driver so we could use rasterio instead of PIL and save on the dependency ;-)

cc @dnomadb

dnomadb commented 5 years ago

@vincentsarago I'm not seeing exactly how to create lossless webps -- is it is simple as setting lossless=True in the rasterio creation kwargs?

Also FWIW we should probably refactor this anyways as it was written before rasterio MemoryFiles were introduced. https://github.com/mapbox/rio-rgbify/blob/31bd65b175938a4362e0e8bf1d3b86d5e8d31e5b/rio_rgbify/mbtiler.py#L93 Looking forward to the PR!

vincentsarago commented 5 years ago

is it is simple as setting lossless=True in the rasterio creation kwargs?

I think yes, https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/profiles.py#L24-L27

Also FWIW we should probably refactor this anyways as it was written before rasterio MemoryFiles were introduced.

👌

Looking forward to the PR!

🤔 sure when you'll merge https://github.com/mapbox/rio-rgbify/pull/18 :trollface:

vincentsarago commented 5 years ago

I'll take care of this issue after #24 ;-)

kylebarron commented 4 years ago

@vincentsarago Now that #24 is merged, is this PR still valid?