How to Add a Watermark to Images Using a Synology DS 110 (Updated)

This is an update to the original post. I added more details and fixed a couple of bugs, and made it so that it should now be easier to create and install the script, without need for Vi.

1) Login with telnet (I know, you should really use SSH, but I haven’t gotten around to that yet so I can’t give advice there). You must login as root, not simply as administrator. That is login:root, password:same password as admin.

2) All the following script lines should be simply copied and pasted (even with comments) directly in the telnet window, all of them in one go. All the file paths are absolute, so it doesn’t matter in which directory you are when you paste. Everything will be created and “installed” automatically. It works fine from the system telnet in the Terminal.app in OS X, I don’t know in other terminals. If not, you will need to use Vi to create the script file.

### 1) create backup copy of the original convert
cp /lib/hddapp/usr/syno/bin/convert /lib/hddapp/usr/syno/bin/convert.bak

### 2) rename original convert file and setup new symlinks
echo 'mv /lib/hddapp/usr/syno/bin/convert /lib/hddapp/usr/syno/bin/convert.original-binary' > /root/convert--new-link.sh
chmod 744 /root/convert--new-link.sh
/root/convert--new-link.sh

### 3) create convert script
echo '#!/bin/sh
# Execute the original convert for each image
/lib/hddapp/usr/syno/bin/convert.original-binary -verbose "$@" >> /root/log.txt
echo "---------------------------" >> /root/log.txt
# loop through all the argument until last one
for last; do true; done
# only add watermark to certain size thumbs, with transparency at 25%
if [ $5 == 640x640 ] || [ $5 == 800x800 ]; then
    eval /usr/syno/bin/composite -verbose -dissolve 25% -gravity southeast /root/watermark \"$last\" \"$last\" >> /root/log.txt
    echo "---------------------------" >> /root/log.txt
fi ' > /lib/hddapp/usr/syno/bin/convert
chmod 755 /lib/hddapp/usr/syno/bin/convert

### 4) create script to restore convert file
echo 'mv /lib/hddapp/usr/syno/bin/convert.original-binary   /lib/hddapp/usr/syno/bin/convert' > /root/convert--restore-default-link.sh
chmod 744 /root/convert--restore-default-link.sh

### 5) setup convenient symlinks
ln -fs /usr/syno/bin/composite                /root/composite
ln -fs /lib/hddapp/usr/syno/bin/convert       /root/myconvert
ln -fs /etc/rsyncd.conf                       /root/rsyncd.conf
ln -fs /usr/syno/bin/                         /root/sb
ln -fs /usr/syno/etc.defaults/                /root/se
ln -fs /lib/hddapp/usr/syno/bin/              /root/sl
ln -fs /usr/syno/etc.defaults/thumb.conf      /root/thumb.conf
ln -fs /volume1/photo/watermark/watermark.gif /root/watermark
ln -fs /volume1/photo/watermark               /root/watermark_album

3) You need to create the watermark image file separately. It does not have to be a .gif, thankfully composite is clever enough to handle the image format automatically. The watermark image file then needs to be saved anywhere the /root/watermark link points to. In my case:

/volume1/photo/watermark/watermark.gif

Image with watermark on the bottom right

4) This should do it, if there are issues let me know. If you want to remove everything and go back to the default configuration this is the “uninstall” script. Copy and paste it in the terminal window just like above:

### remove everything
/root/convert--restore-default-link.sh
rm /root/convert--restore-default-link.sh
rm /root/convert--new-link.sh
rm /root/composite
rm /root/myconvert
rm /root/rsyncd.conf
rm /root/sb
rm /root/se
rm /root/sl
rm /root/thumb.conf
rm /root/watermark
rm /root/watermark_album

2 thoughts on “How to Add a Watermark to Images Using a Synology DS 110 (Updated)

    • I haven’t tested it on 3.2 yet, so I can’t guarantee that it will work. You can try and if it doesn’t work you can always go back to the default configuration, the procedure I suggest is non-destructive.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s