Ggplot(aes(x=colorspace, y=ypos, fill=hex, height=sat*value)) + Height=sat*hue, width=value, alpha=value)) + Ggplot(aes(x=colorspace, y=hue, fill=hex, Ggplot(aes(x=colorspace, y=ypos, fill=hex)) + Mutate(ypos=row_number(hue)) %>% # alter stacking order Resulting colour palettes are similar but different… So I’ve decided to play around… polar1 % HCLp and HCL are also the same in this case. LCHab, and LCH in this case was same too. Also Undefined, Transparent, sRGB seemed to resulted in exact same palettes. ScRGB and RGB seems to return same results. I still don’t undertand why, but some colourspaces returns reduced number of colour palettes below specified max value… I wanted to figure out which colorspaces share same colour palettes, but I wasn’t sure how to go around calculating similarity of palettes… Labs(caption="Using different colourspce to reduce the colour used in images") Theme(axis.text = element_text(color = "black", family="Roboto Condensed", hjust=1)) + Theme_void(base_family="Roboto Condensed") + Geom_text(aes(label=hex), color="#ffffffbe", Ggplot(aes(x=fct_infreq(colorspace),y=ypos, fill=hex)) + Mutate(ypos=row_number(value)) %>% # I decided to stack colours by value. Since using different colourspaces results in slightly different colour sets, I wanted to “map” function in purrr package in action. # if you just want list of colour values. Return(tmp %>% select(colorspace,hex,hue,sat,value,n)) # I want data frame as a result. RGBtoHSV() %>% # i like sorting colour by hue rather than RGB (red green blue)Īs.ame(wide="c") %>% #3 making it wide makes it easier to output hex colour Magick2cimg() %>% # I'm converting, becauase I want to use as.ame function in imager package. Image_quantize(max=n, colorspace=cs) %>% # reducing colours! different colorspace gives you different result (optionally you can specify different colour space) # Function to get n number of colours out of your image. # "RGB" "scRGB" "sRGB" "Transparent" "XYZ" # "Undefined" "CIELab" "CMY" "CMYK" "Gray" There are 37 different colourspaces… I’ve googled bunch… I’ve heard of “HSV”,“RGB”,“Luv”,“CMYK”, but some I have not even heard of before… # To view different colourspace you can specify in image_quantize function. You can specify different colourspace! You can see different colourspaces you can specify by typing in colorspace_types(). I wanted to ulitimately get hex values I can use with ggplot2 to plot, but I got really intrigued with option I can use in image_quantize function. Extracting “Colours” from Quantized Images
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |