Package 'palettizer'

Title: R Package for Color Palette Generation Using the 'palettize' C++ Library
Description: R package for color palette generation using the 'palettize' C++ library.
Authors: Gustavo Velásquez [aut, cre], Isabella Velásquez [aut], gvlsq [aut]
Maintainer: Gustavo Velásquez <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-12-07 04:08:39 UTC
Source: https://github.com/gvelasq/palettizer

Help Index


Check if a file is an image from a supported format

Description

plt_check() is a wrapper around the C++ function stbi_info from stb_image.h. It checks whether a file is an image from a supported format. This is useful for checking whether plt_tize() can create a color palette from a file without having to decode the entire file.

Usage

plt_check(path)

Arguments

path

A path to a file to be checked.

Details

Future versions of this function will expose how to query the width, height, and component count of an image.

Value

plt_check() returns TRUE if the file is an image from a supported format, and returns FALSE for non-image files and images from unsupported formats.


Create a color palette

Description

plt_tize() creates a color palette from a supported image file.

Usage

plt_tize(path, cluster_count, seed, sort_type = "weight")

Arguments

path

A path to a supported image file.

cluster_count

The number of clusters for k-means clustering.

seed

An integer to specify the seed for the random number generator.

sort_type

A character vector, one of "weight" (the default), "red", "green", or "blue".

Value

A character vector of hexadecimal colors.