We prove that the annihilating-ideal graph of a commutative semigroup with unity is, in general, not weakly perfect. This settles the conjecture of DeMeyer and Schneider [‘The annihilating-ideal graph of commutative semigroups’, J. Algebra469 (2017), 402–420]. Further, we prove that the zero-divisor graphs of semigroups with respect to semiprime ideals are weakly perfect. This enables us to produce a large class of examples of weakly perfect zero-divisor graphs from a fixed semigroup by choosing different semiprime ideals.