library(magick)
## Linking to ImageMagick 6.9.12.3
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
# 先获取一张图片(URL/本地)
setwd("D:\\(R) plots collection\\R markdown\\Image processing")
Arya <- image_read("Arya.jpg")
image_info(Arya)
##   format width height colorspace matte filesize density
## 1   JPEG   700    495       sRGB FALSE    23537   72x72
#通过image_write()可以讲图片以任何格式输出,比如将刚读取的图片以png格式输出。
image_write(Arya, path = "Arya.png", format = "png")
image_border(Arya, "pink", "20x20")

#Flip
image_flip(Arya)

#Flop
image_flop(Arya)

a1 <- image_blur(Arya, 10, 5)
a1

a2 <- image_charcoal(Arya)
a2

a3 <- image_implode(Arya)
a3

a4 <- image_noise(Arya)
a4

#油画效果 但不是 很明显
a5 <- image_oilpaint(Arya)
a5

a6 <- image_emboss(Arya)
a6

a7 <- image_negate(Arya)
a7

a8 <- image_animate(c(Arya,a6,a4,a1,a2), fps = 5)
a8

#sexy
q1 <- image_read("Arya1.jpg")
q1 <- image_scale(q1, "500")
q1

q2 <- image_read("Arya2.jpeg")
q2 <- image_scale(q2, "500")
q2

q3 <- image_read("https://bestofcomicbooks.com/wp-content/uploads/2018/06/Arya-Stark-Sexy-Smile.jpg")
q3 <- image_scale(q3, "500")
q3

qq <- image_animate(c(q1,q2,q3), fps = 1)
qq