This error seems to occur randomly on larger files. The error is caused because the lightbox web part is trying to display an image “too fast” and the size of the image is not known at the given time. By increasing the “Load delay:” has the web part "more time" to gather the values. To fix this behavior increase this property value (250 by default) to 500 or higher in the properties of the lightbox web part.