# https://onlinepngtools.com/create-transparent-png
library(hexSticker)
library(showtext)
library(magick)
## Loading Google fonts (http://www.google.com/fonts)
font_add_google("Orbitron", "orbitron")
## Automatically use showtext to render text for future devices
showtext_auto()
col_br <- "#002733"
col_pkg_name <- "white"
col_metronome <- "#006D8F"
col_border <- "#006D8F"
dpi_multiplier <- 1
sticker('imgs/kissclipart-metronomo-png-clipart-metronome-music.png',
s_width = 0.67,
package = "",
url = "tempo",
u_family = "orbitron",
u_size = 19 * dpi_multiplier, u_color = col_pkg_name,
u_x = 1.25 - 0.94, u_y = 0.62, u_angle = -30,
h_color = col_border, h_fill = col_br,
h_size = 1.5,
s_x = 0.91 + (0.91 - 0.75), s_y = 1.14,
filename = "imgs/tempo-sticker.png",
white_around_sticker = TRUE, dpi = 300 * dpi_multiplier)
sticker <- image_read(path = "imgs/tempo-sticker.png")
sticker
image_info(sticker)
# Hack to create blank rectangle
par(mar = c(0,0,0,0))
square <- image_graph(width = 600, height = 600, res = 96)
plot(-10, -10, axes = FALSE, frame.plot = FALSE, ann = FALSE, xlim = c(0, 1),
ylim = c(0, 1))
rect(-10, -10, 20, 20, border = NA, col = "white", lty = "dashed", lwd = 5)
dev.off()
# put sticker on top of square
sticker_square <- image_fill(image_composite(square,
sticker,
offset = "+41+0"),
col_metronome,
point = "+300+100",
fuzz = 10,
refcolor = "black")
image_write(sticker_square, "logo.png")
file.remove("imgs/tempo-sticker.png")
sticker_square
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.