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 |
Convert ggplot plot to image suitable for knitting with AYAB
ggplot_to_ayab(p, width = NULL, height = NULL, bw_method = NULL)
ggplot_to_ayab(p, width = NULL, height = NULL, bw_method = NULL)
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". |
A magick image object
Used internally.
ggplot_to_magick(p)
ggplot_to_magick(p)
p |
The ggplot plot to convert |
A magick image object
Process ggplot object to remove everything except plot area
ggplot_void(p)
ggplot_void(p)
p |
The ggplot plot to process |
A ggplot plot with only the plot area and everything else stripped
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.
magick_to_ayab(fig, width = NULL, height = NULL, bw_method = NULL)
magick_to_ayab(fig, width = NULL, height = NULL, bw_method = NULL)
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". |
A magick image object
Make a simple black and whit grid test ggplot plot
make_test_plot()
make_test_plot()
A ggplot plot
Plot a timeline test ggplot plot
make_test_plot_complex()
make_test_plot_complex()
A ggplot plot
Plot a timeline test ggplot plot with lines
make_test_plot_complex_lines()
make_test_plot_complex_lines()
A ggplot plot
Create magick image object with text
make_text_img(input_text)
make_text_img(input_text)
input_text |
Character string to plot |
A magick image object with the input text
Save magick image object to png
save_ayab_png(fig, filepath)
save_ayab_png(fig, filepath)
fig |
The image object |
filepath |
Desired output file path |
Saves object to file. Returns the file path.
Convert text to image suitable for knitting with AYAB
text_to_ayab(input_text, width = NULL, height = NULL)
text_to_ayab(input_text, width = NULL, height = NULL)
input_text |
The desired text to be knit |
width |
The desired output width in pixels |
height |
The desired output height in pixels |
A magick image object