I'm using i3wm with XFCE as my desktop environment. I've disable the default XFCE lockscreen (light-locker, I believe) in favor of my own locking script which uses i3lock-color, and I'm using xss-lock to trigger the locking script on lid close. The script itself (full script here) basically takes a screenshot, uses ImageMagick to pixellate the image and add a dark rectangle in the bottom left corner of the image (the rectangle provides extra contrast for the text that is overlaid by i3lock-color). Then it uses i3lock-color to lock the screen and display a clock, some text, etc.
When I run the script from the terminal, the result is as expected. The screen is locked with the correct image (including the dark rectangle). 
However, after activating xss-lock with xss-lock -l /path/to/script/lock.sh and then closing the lid, the script runs but the rectangle is not drawn, leading to sometimes unreadable lockscreen text. 
I've tried modifying the script so that it doesn't delete the screenshot that it takes and edits, but the screenshot contains the dark rectangle. I think it's something weird with ImageMagick, since the pixellation and the rectangle drawing are specified in the same command, and the pixellation occurs but the rectangle drawing doesn't.
I'm very confused as to how this could occur. Neither journalctl nor /var/log display anything that looks related to this. Any help on where to begin debugging would be appreciated.