complex functions producing jpg