Created
January 25, 2016 10:54
-
-
Save mdsumner/fede4a8c02b9e6547fed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(webp) | |
| library(png) | |
| library(curl) | |
| u <- "http://oceancolor.gsfc.nasa.gov/cgi/l3/V20160202016022.L3m_R3QL_NPP_CHL_chlor_a_9km.nc.png?sub=img" | |
| f <- gsub("\\?sub=img", "", basename(u)) | |
| curl_download(u, f) | |
| bm <- readPNG(f) | |
| newfile <- gsub("png", "webp", f) | |
| write_webp(bm, newfile) | |
| ## only works in Google Chrome | |
| browseURL(newfile) | |
| sizes <- file.info(c(f, newfile))$size | |
| sizes[1]/sizes[2] | |
| ## [1] 2.059234 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
username and your personal access token when prompted for a username and password.