hypertidy/ceramic

option to compress to palette

Closed this issue · 1 comments

Save the overhead for in memory, and simplify the plotting mech - optionally:

library(ceramic)
im <- cc_location(cbind(131.035, -25.34), buffer = 3000)
library(raster)
pct <- rgdal::SGDF2PCT(as(im, "SpatialGridDataFrame"))
r <- setValues(raster(im), as.integer(pct$idx - 1))
colortable(r) <- pct$ct
#raster::plotRGB(im)
plot(r)
pryr::object_size(r)
# 1.61 MB
pryr::object_size(im)
# 4.76 MB

Use this implementation (rather than the rgdal, GDAL, python inferno):

https://github.com/joelcarlson/RImagePalette