I am currently trying to display some PNGs using the "draw_image" function. To be more precise, these are certain emojis.
As soon as I load the PNGs via draw_image, they are unfortunately distorted, so that the emojis look like this:
But of course the emojis should look more like this:
Unfortunately, I do not currently reach my goal with my tested solutions. For example, I have already tried to manually resize the pictures by reducing the height or increasing the width. Unfortunately without success.
If anyone of you finds a bug in my code (end of post) or alternatively has another solution in mind, I would be very grateful!
Thank you and have a nice Sunday!
Code:
bg <-
image_read(paste("randomimage.png", sep = ""))%>%
image_resize("1748x2480!")
dx <- ggdraw() +
draw_image(bg) +
draw_image(Emoji3, width = 1, height = 1, scale = 0.04)+
draw_image(Emoji2, width = 1, height = 1, scale = 0.04)+
draw_image(Emoji1, width = 1, height = 1, scale = 0.04)
grid.arrange(dx)
ggsave(path = "xxx", filename = paste("randomname.png", sep = ""), dx, width = 210, height = 297, units = "mm", dpi = 100)