I have average colour of my photos arranged chronologically January 1, 20219 - December 31, 2020. It may be wrong, need to double check :-) This is the output of photoshop in interleaved mode, 3 channels (R, G, B)

january 1, 2019, december 31, 2020-interlaced-2020-and-2019-roland-flickr-imagemagick-average-colours

Extra Bonus “glitch” art

  • when you don’t use interleave mode in Photoshop

wrong aka glitch art :-) 2020-and-2019-roland-flickr-imagemagick-average-colours


05april2021 still not sure why imagemagick doesn’t work, maybe because the header is missing or maybe because it doesn’t end with ‘.raw’?

05april2021 the file has to be called .raw to be opened in photoshop in interleaved mode

03april2021 hilariously gnuplot works

plot '2020-and-2019-roland-flickr-imagemagick-average-colours.rgb' binary array=222x222 flipy format='%uchar' with rgbimage


03april2021 create file of colours and then raw file and then png

  • 1. remove the one bad file which has synth_75sqisvalid set to 0 aka false
    mlr --csv cut -f synth_75imaveragecolour,synth_75sqisvalid \
    | grep -v ",0" | wc -l
    mlr --csv cut -f synth_75imaveragecolour,synth_75sqisvalid \
    > 2020-and-2019-roland-flickr-imagemagick-average-colours.csv
    mlr --csv cut -f synth_75imaveragecolour \
    >  2020-and-2019-roland-flickr-imagemagick-average-colours.csv\
    >  | tail -n +2 >2020-and-2019-roland-flickr-imagemagick-average-colours.txt
  • 2. create raw file
    #xxd -r -p 2020-and-2019-roland-flickr-imagemagick-average-colours.txt \
    # 222 x 222 = 49284
    xxd -l 49284 -u -r -p \
    2020-and-2019-roland-flickr-imagemagick-average-colours.txt 2020-and-2019-roland-flickr-imagemagick-average-colours.rgb
  • 3. create png
  • square root of 49549 is approximately 222
    magick convert -depth 8  -size 222x222 2020-and-2019-roland-flickr-imagemagick-average-colours.rgb\
  • fails on ubuntu 20.04 with convert and on macOS catalina with magick:
convert -size 222x222 -depth 8 RGB:2020-and-2019-roland-flickr-imagemagick-average-colours.rgb image.png
convert-im6.q16: unexpected end-of-file `2020-and-2019-roland-flickr-imagemagick-average-colours.rgb': No such file or directory @ error/rgb.c/ReadRGBImage/242.
convert-im6.q16: no images defined `image.png' @ error/convert.c/ConvertImageCommand/3258.

03april2021 imagemagick average colour worked?!?

roland@Rolands-MacBook-Air THUMBS_75X75 % bundle exec ../get-filename-imagemagick-average-colour-from-75x75thumbnail.rb \
../../files_too_big_for_github_rt-flickr-sqlite-csv/2020-and-2019-roland-flickr-metadata.csv \

03april2021 current plan

  • I don’t trust myself :-) to take the 100% care needed to get csvjoin to work, it’s easy to mess up
  • so i will add the column from ruby and in fact have multiple columns
    • synth_75sqfilename (the filename of the 75x75 thumbnail)
    • synth_75imaveragecolour (average colour by resizing to 1x1 in imagemagick)
    • synth_75sqisvalid (in case the thumbnail is not a valid jpeg or png), 1 = valid, 0 = invalid (there’s only 1 invalid 75x75px thumbnail from all 45000 2019-2020 photos

03april2021 csvjoin does add columns like i want

roland@Rolands-MacBook-Air THUMBS_75X75 % cat testcsv.csv 
roland@Rolands-MacBook-Air THUMBS_75X75 % cat column2.csv 
roland@Rolands-MacBook-Air THUMBS_75X75 % csvjoin testcsv.csv column2.csv

Leave a comment on github