don't open images until we need them; keep image type if excel can read it
Created originally on Bitbucket by squall (Squall -)
Changesets for this Pull Request have not been imported, because it had been already declined on Bitbucket. Marked as closed by the import user.
instead of storing the image object, the image class saves the filename and reads the file once when instantiated, to get the dimensions of the image, and a second time when the file gets written to disk. this saves memory and prevents from failing when adding a lot of images (ioerror: too many open files).
try to keep the image's file format instead of forcing it to be converted to png. this reduces the output's file size if it contains photos which are usually stored as jpeg.