I'm looking for a tool that can extract detect and extract any image format from word documents in both .doc and .docx formats for an automatic document classification use case. It is nice to just detect the presence of images, but it infinitely more valuable to automatically carve the images out of the file through detecting the magic bytes and carving based on the file header.
I'm looking for something like oletools, but that toolkit doesn't support gathering images.
If there aren't any tools or libraries that satisfy my use case, then any libraries or tools that could support my own development of such a tool would be appreciated. Even research papers or articles on the theory behind such a tool, or even the doc/docx file format would be appreciated.
I would prefer python based tools, but I'll take what I can get. To be clear, I want a command line based tool, or a tool that can be added to a program or a script.