logo <- image_read(system.file("Rlogo.png", package = "magick"))
logo <- image_scale(logo, "400")
image_trim(logo)
image_crop(logo, "400x400+200+200")
image_scale(logo, "200x200")
image_sample(logo, "200x200")
image_border(logo, "red", "10x10")
image_noise(logo)
image_blur(logo, 10, 10)
image_charcoal(logo)
image_edge(logo)
image_oilpaint(logo)
image_emboss(logo)
image_enhance(logo)
image_equalize(logo)
image_flip(logo)
image_flop(logo)
image_frame(logo)
image_implode(logo)
image_negate(logo)
image_normalize(logo)
image_rotate(logo, 45)
image_fill(logo, "red")
image_fill(logo, "red", fuzz = 256^2)
image_chop(logo, "100x20")
image_colorize(logo, 50, "red")
# Compose images using one of many operators
oldlogo <- image_read(system.file("Rlogo-old.png", package = "magick"))
image_composite(logo, oldlogo)
image_composite(logo, oldlogo, operator = "copyred")
# Lights up the R logo
frames <- image_scale(oldlogo, "400x400")
for(i in 1:7) frames <- c(frames, image_contrast(frames[i]))
(blink <- image_animate(c(frames, rev(frames)), fps = 20, loop = 1))
# Add some text to an image
image_annotate(logo, "This is a test")
image_annotate(logo, "CONFIDENTIAL", size = 50, color = "red", boxcolor = "pink",
degrees = 30, location = "+100+100")
# Setting fonts requires fontconfig support (and that you have the font)
myfont <- ifelse(identical("windows", .Platform$OS.type), "courier-new", "courier")
image_annotate(logo, "The quick brown fox", font = myfont, size = 50)
Run the code above in your browser using DataLab