h2 {
background-color:lightblue;
color:white;
font:bold;
}
This is my first meme used for finishing the assignment of Stats 220 in the University of Auckland. The meme includes two pictures. One is my photo, the other is a rabbit from the Internet,and I write a sentence of “I like rabbits” below the pictures.
library(magick)
# create a solid canvas
blank <- image_blank(306, 30, "pink")
# read and resize an image from Internet
meme_1 <- image_read("https://freedesignfile.com/upload/2017/08/Rabbit-cute-cartoon-vector-01.jpg") %>%
image_resize("200x200")
# read and resize an image from disk
meme_2 <- image_read("mmexport1607387493428.jpg") %>%
image_resize("200x200")
# append two images side by side
meme_3 <- image_append(c(meme_2,meme_1))
# append a blank image below
# add some text
# save to current directory
image_append(c(meme_3,blank),stack=TRUE) %>%
image_annotate("I like rabbits",size=20,color = "green",location = "+105+200") %>%
image_write("my_meme.png")
The animated GIF below shows 4 pictures, which I took in the Spring Festive in China this year. I created the GIF with the software package of Magick in R. I think it is a good way to record my life.
library(magick)
# read 4 images from disk and resize to the same size
meme1 <- image_read("IMG_20230218_160839-1.jpg") %>% image_resize("300x300")
meme2 <- image_read("IMG_20230211_143953-1.jpg") %>% image_resize("300x300")
meme3 <- image_read("IMG_20230218_154210-1.jpg") %>% image_resize("300x300")
meme4 <- image_read("IMG_20230218_154347-1.jpg") %>% image_resize("300x300")
#merge the 4 images
img_merge <- c(meme1,meme2,meme3,meme4)
#animate the 4 images
animation = image_animate(img_merge,fps=10,delay = 1*100)
#save the animation image to a GIF file
image_write(animation,"my_animation.gif")