fixes a crash when the picture has size of (0,0)