Image mImage;
try {
OdfElement parent = container.getFrameContainerElement();
OdfFileDom ownerDom = (OdfFileDom) parent.getOwnerDocument();
DrawFrameElement fElement = ownerDom.newOdfElement(DrawFrameElement.class);
parent.appendChild(fElement);
DrawImageElement imageElement = fElement.newDrawImageElement();
// set uri and copy resource
String packagePath = insertImageResourceIntoPackage((OdfSchemaDocument) ownerDom.getDocument(), uri);
packagePath = packagePath.replaceFirst(ownerDom.getDocument().getDocumentPath(), "");
URI newURI = configureInsertedImage((OdfSchemaDocument) ownerDom.getDocument(), imageElement, packagePath,
false);