How to Add a Watermark to Images Using a Synology DS 110

UPDATE 2: It is now fixed also for version 3.1-1613. The update deserved a brand new post. This post below should be considered obsolete and ignored.

UPDATE: Looks like this doesn’t work anymore in firmware version 3.1-1613 that came out on April 11th.

Very concisely (I might add more explanations later):

1) You must login as root, not simply as administrator

2) Optional – Symbolic links just for convenience:

SynologyDS110> pwd
/root
SynologyDS110> ll
drwxr-xr-x    5 root     root          4096 Dec 25 00:02 .
drwxr-xr-x   20 root     root          4096 Dec 24 22:57 ..
drwx------    3 root     root          4096 Nov 29 00:19 .cache
drwx------    3 root     root          4096 Nov 29 00:19 .config
drwx------    3 root     root          4096 Nov 29 00:19 .local
-rw-r--r--    1 root     root           396 Sep  4  2003 .profile
lrwxrwxrwx    1 root     root            23 Dec  8 17:42 composite -> /usr/syno/bin/composite
-rw-rw-rw-    1 root     root          6638 Dec 24 23:53 log.txt
lrwxrwxrwx    1 root     root            35 Dec 24 22:48 myconvert -> /lib/hddapp/usr/syno/bin/convert.sh
lrwxrwxrwx    1 root     root            16 Dec  8 17:14 rsyncd.conf -> /etc/rsyncd.conf
-rw-r--r--    1 root     root           513 Nov 29 00:28 rsyncd.conf.mod
lrwxrwxrwx    1 root     root            14 Dec  8 17:09 sb -> /usr/syno/bin/
lrwxrwxrwx    1 root     root            23 Dec  8 17:09 se -> /usr/syno/etc.defaults/
lrwxrwxrwx    1 root     root            25 Dec  8 17:11 sl -> /lib/hddapp/usr/syno/bin/
lrwxrwxrwx    1 root     root            33 Dec  8 17:13 thumb.conf -> /usr/syno/etc.defaults/thumb.conf
lrwxrwxrwx 1 root root 28 Dec 25 00:02 watermark -> /volume1/photo/watermark/watermark.gif
lrwxrwxrwx    1 root     root            24 Dec  8 17:39 watermark_album -> /volume1/photo/watermark

3) Create this text file

/lib/hddapp/usr/syno/bin/convert.sh

and leave it empty for now.
Change the following sym link (with “ln -fs …”) from:

/usr/syno/bin/convert -> /lib/hddapp/usr/syno/bin/convert

to:

/usr/syno/bin/convert -> /lib/hddapp/usr/syno/bin/convert.sh

4) Rename

/lib/hddapp/usr/syno/bin/convert

to

/lib/hddapp/usr/syno/bin/convert.original-binary

(or any other meaningful name you like)

Note:

/lib/hddapp/usr/syno/bin/convert.original-binary

will be called from convert.sh, so if you change its name you must update it accordingly in the code below

5) Copy this code in convert.sh (could be more elegant but it works):

#!/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
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

6) Your watermark file needs to be anywhere the /root/watermark link points to. In my case (see highlighted line in point 2 above):

/volume1/photo/watermark/watermark.gif

3 thoughts on “How to Add a Watermark to Images Using a Synology DS 110

  1. Hey.

    Thanks for the guide. I haven’t tried it yet, because I’m not too familiar with telnet. I’m not sure how to do step 3 in your guide – the “ln -fs …”-part.

    I hope you will consider emphasizing your guide. A before and after picture would also be nice (for inspiration).

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