Jay Taylor's notes

back to listing index

How I Ruined Office Productivity With a Face-Replacing Slack Bot · zikes.me blog

[web search]
Original source (blog.zikes.me)
Tags: golang go irc image-processing slack facial-recognition slackbot blog.zikes.me
Clipped on: 2017-02-19

code and games
© Jason Hutchinson
Built with Hugo and Hyde-Y.

How I Ruined Office Productivity With a Face-Replacing Slack Bot

(Without Really Knowing What I Was Doing)

February 16, 2017 · Read in about 8 min · (1594 Words)

Meet Chris.

Image (Asset 1/27) alt=


The first iteration used Slack uploads, but being on a free Slack tier meant this was not ideal. I changed that to save the output locally onto my server, and then link that in Slack. Since Slack will auto-expand most image links, this wound up being an equivalent user experience for most people without as much risk of me getting in trouble with the office bigwigs.

With easy access to the process, I was able to more easily experiment with the face replacer. I realized that if it didn’t find any faces at all, it would just echo the same image back. That’s no fun! So I threw this in after the loop:

if len(faces) == 0 {
  // Grab a specific face and resize it to 1/3 the width
  // of the base image
  face := imaging.Resize(

  face_bounds := face.Bounds()

    // I'll be honest, I was a couple beers in when I came up with this and I
    // have no idea how it works exactly, but it puts the face at the bottom of
    // the image, centered horizontally with the lower half of the face cut off

Which gave me this:

Image (Asset 2/27) alt=