Last active
December 2, 2019 17:37
-
-
Save kimjoaoun/745a3900d86b83af392b3ab2e32dca85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image_path <- magick::image_read("Certificado_delegados-1.jpg") # Lê a imagem base, sem os nomes | |
info <- image_info(image_path) # Informações da Imagem (Tamanho, etc.) | |
dataset <- readr::read_csv("dataset.csv") # Dataset com as informações dos participantes | |
for (i in dataset$`Nome completo:`) { #coloque aqui o nome da coluna que contém o nome dos participantes do evento. | |
if (nchar(i) < 25) { | |
# Esse if() muda o ponto inicial de escrita, serve p/ nomes grandes ficarem centralizados | |
# Vai ser necessário alterar conforme o tamanho da sua imagem, etc. Tentativa e erro. | |
# O primeiro número indica onde o texto ficará no eixo X, o segundo valor regula o eixo Y. | |
loc <- "+850+810" #!! | |
} else { | |
loc <- "+755+810" #!! | |
} | |
cert <- magick::image_annotate(image = image_path, text = i, size = 55, color = "black", location = loc) | |
# Cria o certificado. | |
image_write(cert, path = stringr::str_c("certificado_", i, ".png"), format = "png") | |
# Escreve ele na memória | |
print(i) | |
# Printa o nome no console, para sabermos onde estamos. | |
# Os certificados terão o nome "certificado_NOME COMPLETO.png" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment