rio-rgbify icon indicating copy to clipboard operation
rio-rgbify copied to clipboard

Use Rasterio to create webp

Open vincentsarago opened this issue 6 years ago • 4 comments

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

vincentsarago avatar Mar 27 '19 03:03 vincentsarago

@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!

dnomadb avatar Mar 27 '19 13:03 dnomadb

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 avatar Mar 27 '19 13:03 vincentsarago

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

vincentsarago avatar Mar 30 '19 18:03 vincentsarago

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

kylebarron avatar Dec 12 '19 05:12 kylebarron