Skip to content

Latest commit

 

History

History
112 lines (88 loc) · 4.51 KB

README.md

File metadata and controls

112 lines (88 loc) · 4.51 KB

CRAN_Status_Badge Lifecycle Build Status cranlogs

colorizer

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.

Installation

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")

Functions

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.

Examples

Breadfruit, approx. 1870

# API call
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") 

Children, 1920s

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")

My Grandpa, 1936

colorizer::colorize(
  img = "diskus1936.jpg", 
  key = my_key
  ) %>%
  colorizer::juxtapose("side-by-side") %>% 
  colorizer::clsave("HansZumbach.jpg") 

John Wayne and Gail Russell, 1940s

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") 

Types of juxtaposition

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"