Wired: Cover Art

5
library(raster) library(plotrix) m <- matrix(,nrow=12,ncol=1) a <- seq(1,9,1) m[1:9] <- paste("0",a,sep="") m[10:12] <- as.character(seq(10,12,1)) y <- as.character(seq(1993,2015,1)) d <- merge(y,m) colnames(d) <- c("y","m") d <- d[order(d$y),] d1 <- d[1:6,1:2] d2 <- d[13:267,1:2] d <- rbind(d1,d2) d1 <- d[1:203,1:2] d1$url <- paste(d1$y,"_",d1$m,sep="") d2 <- d[204:261,1:2] d2$url <- paste(d2$y,"-",d2$m,sep="") d <- rbind(d1,d2) n <- length(d$url) nk <- 4 covers <- matrix(,nrow=nk*n,ncol=5) s <- 1 e <- nk for (i in 1:n) { url <- paste("/Users/ChCariou/Desktop/Wired/covers_all/",d$url[i],".jpg",sep="") cover <- brick(url) cover00 <- getValues(cover) cover01 <- kmeans(cover00,nk) covers[s:e,1] <- i covers[s:e,2:5] <- cbind(cover01$centers/255,cover01$size/sum(cover01$size)) s <- s+nk e <- e+nk } colnames(covers) <- c("id","R","G","B","Weight") covers <- covers[order(covers[,5],decreasing=TRUE),] rayon <- 6 S <- pi*rayon*rayon n <- length(covers[,1]) dev.off() quartz(width=10,height=10,bg="#D5D4C4") par(mar=c(0,0,0,0),oma=c(0,0,0,0),mgp=c(0,0,0)) plot(0,0,type="n",asp=1,xlim=c(-260,260),axes=FALSE,xlab=NA,ylab=NA,xaxs="i",yaxs="i") for (i in 1:n) { R <- covers[i,2]*255 G <- covers[i,3]*255 B <- covers[i,4]*255 M <- max(c(R,G,B)) m <- min(c(R,G,B)) C <- M-m if (C!=0) { if (M==R) {H <- 60*((G-B)/C+6)} if (M==G) {H <- 60*((B-R)/C+2)} if (M==B) {H <- 60*((R-G)/C+4)} X <- C*cos(H/180*pi) Y <- C*sin(H/180*pi) s <- covers[i,5]*S r <- sqrt(s/pi) draw.circle(X,Y,r,col=rgb(covers[i,2], covers[i,3], covers[i,4]),border=NA) }} The 261 covers since 1993. Each cover is represented by four colors and their weight. The 1044 colors are placed on the color wheel. cover art by Christophe Cariou with R | FEB 2015

Transcript of Wired: Cover Art

library(raster)

library(plotrix)

m <- matrix(,nrow=12,ncol=1) a <- seq(1,9,1) m[1:9] <- paste("0",a,sep="") m[10:12] <- as.character(seq(10,12,1))

y <- as.character(seq(1993,2015,1)) d <- merge(y,m) colnames(d) <- c("y","m") d <- d[order(d$y),]

d1 <- d[1:6,1:2] d2 <- d[13:267,1:2] d <- rbind(d1,d2)

d1 <- d[1:203,1:2] d1$url <- paste(d1$y,"_",d1$m,sep="") d2 <- d[204:261,1:2] d2$url <- paste(d2$y,"-",d2$m,sep="")

d <- rbind(d1,d2)

n <- length(d$url)

nk <- 4 covers <- matrix(,nrow=nk*n,ncol=5) s <- 1 e <- nk for (i in 1:n) { url <- paste("/Users/ChCariou/Desktop/Wired/covers_all/",d$url[i],".jpg",sep="") cover <- brick(url) cover00 <- getValues(cover) cover01 <- kmeans(cover00,nk) covers[s:e,1] <- i covers[s:e,2:5] <- cbind(cover01$centers/255,cover01$size/sum(cover01$size)) s <- s+nk e <- e+nk

}

colnames(covers) <- c("id","R","G","B","Weight")

covers <- covers[order(covers[,5],decreasing=TRUE),] rayon <- 6 S <- pi*rayon*rayon

n <- length(covers[,1]) dev.off() quartz(width=10,height=10,bg="#D5D4C4") par(mar=c(0,0,0,0),oma=c(0,0,0,0),mgp=c(0,0,0)) plot(0,0,type="n",asp=1,xlim=c(-260,260),axes=FALSE,xlab=NA,ylab=NA,xaxs="i",yaxs="i")

for (i in 1:n) {

R <- covers[i,2]*255 G <- covers[i,3]*255 B <- covers[i,4]*255

M <- max(c(R,G,B)) m <- min(c(R,G,B)) C <- M-m

if (C!=0) {

if (M==R) {H <- 60*((G-B)/C+6)} if (M==G) {H <- 60*((B-R)/C+2)} if (M==B) {H <- 60*((R-G)/C+4)}

X <- C*cos(H/180*pi) Y <- C*sin(H/180*pi)

s <- covers[i,5]*S r <- sqrt(s/pi)

draw.circle(X,Y,r,col=rgb(covers[i,2], covers[i,3], covers[i,4]),border=NA) }}

The 261 covers since 1993. Each cover is represented by four colors and their weight. The 1044 colors are placed

on the color wheel.

cover art

by Christophe Cariou with R | FEB 2015

0%

100%

25%

50%

75%

18.06 18.07 18.08 18.09 18.10 18.11 18.12

19.01 19.02 19.03 19.04 19.05 19.06 19.07 19.08 19.09 19.10 19.11 19.12

20.01 20.02 20.03 20.04 20.05 20.06 20.07 20.08 20.09 20.10 20.11 20.12

21.01 21.02 21.03 21.04 21.05 21.06 21.07 21.08 21.09 21.10 21.11 21.12

22.01 22.02 22.03 22.04 22.05 22.06 22.07 22.08 22.09 22.10 22.11 22.12

23.01 23.02 23.03

The last 58 covers. Each cover is represented by six colors and their weight.

WIRED. COVER ART.

By Christophe Cariou with R - March 2015.

The last 58 covers. Each cover is represented by six colors and their weight.

WIRED. COVER ART.

By Christophe Cariou with R - March 2015.

23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03

The last 58 covers. Each cover is represented by six colors and their weight.

WIRED. COVER ART.

By Christophe Cariou with R - March 2015.

23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03 23.04 23.05 23.06 23.07 23.08 23.09 23.10 23.11 23.12

23.01 23.02 23.03

More information here :

www.chcariou.fr/tagged/wired