create_pattern_from_image: Transform an image raster array into a cross-stitch pattern

View source: R/create_pattern_from_image.R

create_pattern_from_imageR Documentation

Transform an image raster array into a cross-stitch pattern

Description

Transform an image raster array into a cross-stitch pattern

Arguments

image

A raster array from an image.

size_unit

The unit by which the image will be scaled. Can be one of the following options: 'stitches', 'inches', or 'cm'

img_size

Size of the embroidery, in the unit determined by size_unit. Use a single value (e.g. 48) for a square image. Use a vector of two values for a rectangular image c(width, height). NOTE: This parameter sets the size of the embroidery once it will is embroidered. The embroidery pattern that will be outputted will be larger.

cloth_count

Specify the aida cloth count to work with. Set to 16 by default.

brightness

A value >1 will increase the brightness of the image while a positive value <1 will decrease the brightness.

warhol

Array of values c(1, 2, 3) associated with R, G, B colour channels. Swap values in array to swap colour channels for a fun visual effect.

method

Default 'cie94'. The method to use for colour comparison. Either 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'. See farver::compare_colour.

colour_table

Defaults to dmc_colours. Data frame of colours to map onto image. Must contain name and red, green, blue channels. See attached data dmc_colours as examples. Original source for dmc_colours is: https://github.com/sharlagelfand/dmc

colour_palette

Used to supply a character vector of specific DMC colours to use. Can be particularly useful in instances where you already have many colours available and maintain a list of their DMC codes. Defaults to NULL - in which case all DMC colours are to be considered. Ignored if a colour_table is supplied.

n_colours

Optional: Integer representing the maximum number of colours to use. This option selects the n_colours that appear the most, and remaps all other colours to match these n_colours. Otherwise, defaults to NULL.

trans_bg

If img is a png and has a transparent background, name of colour to replace the background.

dithering

Improves colour of large, photo-realistic mosaics.

style

Options for visualisation. Defaults to a tiled pattern with DMC numbers

colour_list

Whether a list of colours should also be output. Defaults to TRUE.

file_name

Option to name the output files. Defaults to "embroidr_pattern"

Value

An SVG file with the cross-stitch pattern. If colour_list is set to TRUE, a second SVG file containing a list of DMC colours used is also output.


BenjaminVigreux/embroidr documentation built on June 1, 2022, 12:51 a.m.