media-gfx/graphicsmagick-1.3.25 should make sure that it is installed with the same ABI slot of media-libs/libwebp as it was built against. Or in other words: Depend on media-libs/libwebp:=, especially since almost all available versions of libwebp support this.
commit a42849dca1e9e90dd0122a6af97e395363a4b42d (HEAD -> master, origin/master, origin/HEAD) Author: Lars Wendler <polynomial-c@gentoo.org> Date: Tue Jul 18 11:52:07 2017 media-gfx/graphicsmagick: Added sub-slot dep for libwebp (bug #609170). Package-Manager: Portage-2.3.6, Repoman-2.3.2