This looks like a bug in tex4ht support for ODT. I submitted a bug report.
All pictures should be placed in Pictures directory in the odt file, but subdirectories are created for files which were originally in subdirectory of the compiled document.
To fix that, we need to modify configuration of image handling and some commands in tex4ht.env. We need to change links to images from Pictures/subdir/imagename to Pictures/imagename. At the same time, we need to track path to the actual image file, so it can be copied to the correct location.
You linked some test package, I will use that as basis for tests. There is a config file, myconfig.cfg.
Basic configuration for handling image inclusion is \Configure{graphics*}:
\Configure{graphics*}
{png}
{\Picture[IMG]{imagename.png}}
we need to provide such configuration for each graphics type. imagename is saved in \Gin@base macro by graphicx package, but it contains full path. \Picture command is responsible for printing image element and we need only base name here. To strip path out, we can use etoolbox list processing commands:
\RequirePackage{etoolbox}
\Preamble{xhtml}
\DeclareListParser{\getImgFileParser}{/}
\makeatletter
\newcommand\getImgFile[2]{%
\def\do##1{\def\imgBaseName{##1.#2}\def\imgBase{##1}}
\def\ImgFullName{#1.#2}
\getImgFileParser{#1}
}
we declared \getImgFile command, with two parameters, file name and suffix, we save full path in \ImgFullName, we will pass this to the copy command later. \getImgFileParser process each part of path delimited by / and save it with and without suffix to two macros. Since imagename is the last part, it will be saved after processing.
We can use this macro in a following way:
\Configure{graphics*}
{png}
{\expandafter\getImgFile\expandafter{\Gin@base}{png}
\Picture[IMG]{\imgBase.png}}
we need to use \expandafter to expand \Gin@base contents.
Now we need to configure image element, with \Configure{IMG}:
\catcode`\:=11
\Configure{IMG}
{\ht:special{t4ht>\ImgFullName.4og}%
\ht:special{t4ht*>}%
\ht:special{t4ht<\ImgFullName.4og}%
\OOmanifest{<manifest:file-entry
manifest:full-path="Pictures/\imgBaseName"/>\Hnewline
}%
%
\ht:special{t4ht=<draw:frame
draw:name="\imgBaseName"
text:anchor-type="as-char" % "paragraph"
% svg:width="...pt"
% svg:height="...pt"
draw:z-index="0"
>%
<draw:image\Hnewline
xlink:href="Pictures/}}
{\ht:special{t4ht=" \Hnewline
xlink:type="simple"
xlink:show="embed"
xlink:actuate="onLoad"
\ifx\noBoundingBox\UnDefined
\string svg:width="\the\Gin@req@width"
svg:height="\the\Gin@req@height"
\fi
/><!--draw:name="}}
{" }
{\ht:special{t4ht=" }}
{\ht:special{t4ht=--></draw:frame>}}
\catcode`\:=12
this configuration is copied from ooffice.4ht, I only changed file paths utilising \ImgFullName and \imgBaseName. I also added code for image dimensions.
Full contents of mychonfig.cfg with configurations for all supported image formats:
\RequirePackage{etoolbox}
\Preamble{xhtml}
\DeclareListParser{\getImgFileParser}{/}
\makeatletter
\newcommand\getImgFile[2]{%
\def\do##1{\def\imgBaseName{##1.#2}\def\imgBase{##1}}
\def\ImgFullName{#1.#2}
\getImgFileParser{#1}
}
\Configure{graphics*}
{pdf}
{\Needs{"convert \csname Gin@base\endcsname.pdf
\csname Gin@base\endcsname.png"}%
\expandafter\getImgFile\expandafter{\Gin@base}{png}
\Picture[IMG]{\imgBase.png }}
\Configure{graphics*}
{gif}
{\expandafter\getImgFile\expandafter{\Gin@base}{gif}
\Picture[IMG]{\imgBase.gif }}
\Configure{graphics*}
{png}
{\expandafter\getImgFile\expandafter{\Gin@base}{png}
\Picture[IMG]{\imgBase.png}}
\Configure{graphics*}
{jpg}
{\expandafter\getImgFile\expandafter{\Gin@base}{jpg}
\Picture[IMG]{\imgBase.jpg}}
\Configure{graphics*}
{jpeg}
{\expandafter\getImgFile\expandafter{\Gin@base}{jpeg}
\Picture[IMG]{\imgBase.jpeg }}
\Configure{graphics*}
{svg}
{\expandafter\getImgFile\expandafter{\Gin@base}{svg}
\Picture[IMG]{\imgBase.svg }}
\catcode`\:=11
\Configure{IMG}
{\ht:special{t4ht>\ImgFullName.4og}%
\ht:special{t4ht*>}%
\ht:special{t4ht<\ImgFullName.4og}%
\OOmanifest{<manifest:file-entry
manifest:full-path="Pictures/\imgBaseName"/>\Hnewline
}%
%
\ht:special{t4ht=<draw:frame
draw:name="\imgBaseName"
text:anchor-type="as-char" % "paragraph"
% svg:width="...pt"
% svg:height="...pt"
draw:z-index="0"
>%
<draw:image\Hnewline
xlink:href="Pictures/}}
{\ht:special{t4ht=" \Hnewline
xlink:type="simple"
xlink:show="embed"
xlink:actuate="onLoad"
\ifx\noBoundingBox\UnDefined
\string svg:width="\the\Gin@req@width"
svg:height="\the\Gin@req@height"
\fi
/><!--draw:name="}}
{" }
{\ht:special{t4ht=" }}
{\ht:special{t4ht=--></draw:frame>}}
\catcode`\:=12
\makeatother
\begin{document}
\ConfigureEnv{tabular}
{\HCode{}}{\HCode{}}{}{}
\ConfigureEnv{figure}
{\HCode{}}{\HCode{}}{}{}
% This one removes the rulers. Taking a look at html4.4ht should make
% clear what has been changed.
\Configure{float}
{\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
{\HCode{}}
{\ifvmode \IgnorePar \fi\EndP \HCode{}\csname par\endcsname\ShowPar}
\EndPreamble
Now we need to modify contents of tex4ht.env. Find location of the file with
kpsewhich tex4ht.env
and copy it to the current directory. On unix systems, change following lines:
.4og mkdir -p sxw-%%0.dir/Pictures/%%1
.4og rmdir sxw-%%0.dir/Pictures/%%1
.4og cp %%1 sxw-%%0.dir/Pictures/%%1
to
.4og cp %%1 sxw-%%0.dir/Pictures/
on Windows, some other commands are used, but changes should be similar.
Now we are done with image inclusion, there is just small issue with your example. tex4ht can't find bounding box of the image and it is rendered too small. Use
ebb imagename
command to create bounding box info and in the TeX file change
\usepackage{graphicx}
to
\usepackage[dvipdfm]{graphicx}
after compilation with
mk4ht oolatex test_case_mk4ht myxhtml
the result is following:

odtfile must be only in thePicturesfolders, not any subfolders.tex4htapparently copies subfolders here and it doesn't work – michal.h21 Jan 13 '15 at 14:35