getIMGs: Retrieve and save pictures from a Google Images search.

Description Usage Arguments Value Author(s) References See Also Examples

Description

This functions uses user-provided keywords to perform a Google Images search. It can return a list of objects of EBImage class Image and/or save the images in a local folder for later use.

Usage

1
getIMGs(keywords, number, WRITE, RETURN, imgtype)

Arguments

keywords

A vector containing the keywords for the Google Images search.

number

The number of results to return (default: 5).

WRITE

Logical. Should the function save pictures to hard drive (default: TRUE). If TRUE, the pictures will be saved in the working directory in a folder named after the provided keywords.

RETURN

Logical. Should the function return a list of the images (default: FALSE). Users should use this argument carefully, especially if they request a large number of images, to avoid running out of memory.

imgtype

A character string indicating the type of images returned by the Google Images search (default: "all"). Possible values are "all" (all types of picture), "photo" (only photographs), "face" (only pictures containing faces), "clipart" (only cliparts) and "lineart" (only line art).

Value

If RETURN is TRUE, the function returns a list of objects of EBImage class Image. If FALSE, the function does not return anything

Author(s)

Simon Garnier <garnier@njit.edu>

References

This function uses Google Images (deprecated) JSON API. More information about the API at: https://developers.google.com/image-search/v1/jsondevguide.

See Also

See the EBImage package for more information on manipulating Image objects.

Examples

1
2
3
4
5
6
7
require("EBImage")
imgs <- getIMGs(keywords = c("R", "is", "fantastic"),
                number = 5,
                WRITE = FALSE,
                RETURN = TRUE,
                imgtype = "all")
display(imgs[[1]])

sjmgarnier/GIr documentation built on May 30, 2019, 12:05 a.m.