Extract computeImageSize and writeSizeInfo methods (to reduce size of writeRtfContentWithException for checkstyle). Compiles but untested.