Search code examples
rmagick-r-package

magick annotate picture with arrows


I need to add a arrow to a picture. Currently I'm using the code below but I want to make the arrow longer.

library(magick)
tiger <- image_read_svg('http://jeroen.github.io/images/tiger.svg', width = 400)
print(tiger)

tiger  %>%
  image_annotate(., "Tiger's mouth", size = 15, color = "red",
  boxcolor = "gold", degrees = 00, location = "+196+250", font = 'Times') %>% 
  image_annotate( sprintf('\u2191'), size = 15, color = "red",
  boxcolor = "gold", degrees = 270, location = "+180+265")

enter image description here


Solution

  • Increase the size should do it

    library(magick)
    tiger <- image_read_svg('http://jeroen.github.io/images/tiger.svg', width = 400)
    print(tiger)
    
    tiger  %>%
      image_annotate(., "Tiger's mouth", size = 20, color = "red",
                     boxcolor = "gold", degrees = 00, location = "+250+250", 
                     font = 'Times') %>% 
      image_annotate( sprintf('\u2191'), size = 50, color = "blue",
                      boxcolor = "transparent", degrees = 270, location = "+190+275")
    

    Created on 2018-06-05 by the reprex package (v0.2.0).