added option to use image element dimension instead of image src dimension
BREAKING: changed toJSON(), added toJSON() domain