Package 'rayab'

Title: R package for AYAB compatible images
Description: Functionality to create images suitable for two-color knitting via the AYAB (all yarns are beautiful) open source software/ hardware project from plots, text and images.
Authors: Mario Angst [aut, cre]
Maintainer: Mario Angst <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-12-08 23:20:10 UTC
Source: https://github.com/marioangst/rayab

Help Index


Convert ggplot plot to image suitable for knitting with AYAB

Description

Convert ggplot plot to image suitable for knitting with AYAB

Usage

ggplot_to_ayab(p, width = NULL, height = NULL, bw_method = NULL)

Arguments

p

The ggplot plot

width

The desired output width in pixels

height

The desired output height in pixels

bw_method

One of "threshold" or "quantize" (default). There are two black and white conversion methods, because how well the conversion works depends a bit on the properties of the image given as input (especially colors). The two methods are "quantize" and "threshold".

Value

A magick image object


Create magick image object from ggplot plot object

Description

Used internally.

Usage

ggplot_to_magick(p)

Arguments

p

The ggplot plot to convert

Value

A magick image object


Process ggplot object to remove everything except plot area

Description

Process ggplot object to remove everything except plot area

Usage

ggplot_void(p)

Arguments

p

The ggplot plot to process

Value

A ggplot plot with only the plot area and everything else stripped


Process magick image object for ayab knitting

Description

This function processes a magick image object to be suitable for knitting with ayab. It pixelates the image and then converts it to the desired width and height. Remember, one pixel is one stitch.

Usage

magick_to_ayab(fig, width = NULL, height = NULL, bw_method = NULL)

Arguments

fig

A magick image object

width

The desired output width in pixels

height

The desired output height in pixels

bw_method

One of "threshold" or "quantize" (default). There are two black and white conversion methods, because how well the conversion works depends a bit on the properties of the image given as input (especially colors). The two methods are "quantize" and "threshold".

Value

A magick image object


Make a simple black and whit grid test ggplot plot

Description

Make a simple black and whit grid test ggplot plot

Usage

make_test_plot()

Value

A ggplot plot


Plot a timeline test ggplot plot

Description

Plot a timeline test ggplot plot

Usage

make_test_plot_complex()

Value

A ggplot plot


Plot a timeline test ggplot plot with lines

Description

Plot a timeline test ggplot plot with lines

Usage

make_test_plot_complex_lines()

Value

A ggplot plot


Create magick image object with text

Description

Create magick image object with text

Usage

make_text_img(input_text)

Arguments

input_text

Character string to plot

Value

A magick image object with the input text


Save magick image object to png

Description

Save magick image object to png

Usage

save_ayab_png(fig, filepath)

Arguments

fig

The image object

filepath

Desired output file path

Value

Saves object to file. Returns the file path.


Convert text to image suitable for knitting with AYAB

Description

Convert text to image suitable for knitting with AYAB

Usage

text_to_ayab(input_text, width = NULL, height = NULL)

Arguments

input_text

The desired text to be knit

width

The desired output width in pixels

height

The desired output height in pixels

Value

A magick image object