Role of the image force in charging of dust grains in complex plasmas