quantize_image {RImagePalette}R Documentation

Quantize image

Description

Quantize image into discrete colors using the median cut algorithm

Usage

quantize_image(image, n, ...)

Arguments

image

Matrix The image from which the palette will be extracted from. Should be a 3 (or more) dimensional matrix. The output of a function such as readJPG() or readPNG() are suitable as image.

n

Integer The number of discrete colors to be extracted from the image.

...

Pass any of the arguments for image_palette

Details

Note: This function is extremely slow for large images. Takes up to 20 seconds for 500x500 image on a desktop with 2.7GHz processor and 4Gb ram.

See Also

image_palette

Examples

img <- jpeg::readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
quant_img <- quantize_image(img, n=3)
display_image(img)
display_image(quant_img)

[Package RImagePalette version 0.1.1 Index]