This R package is an interface to the awesome DeOldify image colorization API on DeepAI, providing the possibility to colorize and restore old images. More about the NoGAN learning method used to train DeOldify can be found here.
The default api-key can be used to make a few requests. After registration on DeepAI, around 5000 requests are currently (Oct 2020) possible within the free service.
Version 0.1.0 is on CRAN and can be installed as follows:
install.packages("colorizer")
Install from GitHub for a regularly updated version (latest: 0.1.0):
install.packages("devtools")
devtools::install_github("zumbov2/colorizer")
The package provides three functions/verbs: colorize()
to perform API requests, juxtapose()
to create different comparisons of original and colorized images, and clsave()
to save colorized images and comparisons.
```r
colorizer::colorize( img = "https://upload.wikimedia.org/wikipedia/commons/9/9e/Breadfruit.jpg", key = my_key ) %>%
# Saving colorized image colorizer::clsave(destfile = "colorized.png") %>%
# Comparing colorized image to original colorizer::juxtapose(type = "side-by-side") %>%
# Saving comparsion
colorizer::clsave(destfile = "comparison.png")
```
r
colorizer::colorize(
img = "https://cdn.pixabay.com/photo/2013/02/13/22/38/children-81487_1280.jpg",
key = my_key,
) %>%
juxtapose("side-by-side") %>%
clsave("children1920.jpg")
r
colorizer::colorize(
img = "diskus1936.jpg",
key = my_key
) %>%
colorizer::juxtapose("side-by-side") %>%
colorizer::clsave("HansZumbach.jpg")
r
colorizer::colorize(
img = "https://cdn.pixabay.com/photo/2014/07/16/03/49/john-wayne-394468_1280.jpg",
key = my_key
) %>%
colorizer::juxtapose("side-by-side") %>%
colorizer::clsave("Wayne-Russel.jpg")
The comparisons are made using the magick package – for platform-specific dependencies please see the section Installation. The following juxtaposition types are currently available:
type = "side-by-side"
type = "stacked"
type = "c-focus"
type = "h-focus"
type = "v-focus"
type = "h-split"
type = "v-split"
type = "d-split"
type = "u-animate"
type = "s-animate"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.