Late with this answer. Maybe someone else can profit..

you do not need imagemagick.M

see : http://support.microsoft.com/kb/555171

use strict; # import OLE use Win32::OLE qw(in with); use Win32::OLE::Const; use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 3; # report OLE runtime errors sub Win32_FullPath; if ( $#ARGV == -1 ) { print "Specify a msword file as first commandline argument. Full p +ath to the file is needed\n"; exit; } # specify variables my $filename = $ARGV[0]; chomp $filename; $filename = Win32_FullPath( $filename ) ; my ( $basename ) = $filename; $basename =~ s/\.doc$/_files/; if ( ! -f $filename ) { print "Could not find file : $filename\n"; exit; } # instantiate Word - use the Word application if it's open, otherwise +open new print "Starting word\n"; my $Word = ""; $Word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application', sub {$_[0]->Quit;} ) || di +e "MsWord is not installed\n"; # get already active msword #print ref $Word ,"\n"; if ( ref $Word ne 'Win32::OLE' ) { print "Cound not open word\n"; exit; } $Word->{Visible}= 0; # we don't need to see Word in an active window # open the specified Word doc print "Opening $filename\n"; $Word->Documents->Open( $filename ) or die("Unable to open document ", Win32::OLE->LastError()); my $savenameHTML = ""; ( $savenameHTML = $filename) =~ s/\.doc$/\.html/; $Word->ActiveDocument->SaveAs({ FileName => $savenameHTML, FileFormat => wdFormatHTML}); # close document print "Closing document and Word\n"; $Word->ActiveDocument->Close(); print "Pictures are in directory : \"$basename\"\n"; exit; sub Win32_FullPath ($) { # This sub will return the appropiate WINDOWS file name ( e.g. / will +be \ # c:/hoge/hoge.xls -> c:\hoge\hoge.xls my $file = shift; if ($] ge 5.006) { $file = Win32::GetFullPathName($file); } $file =~ s|/|\\|g; print "SUB win32::FullPath : $file\n"; return "$file"; }
Notice : See also : http://cnedelcu.blogspot.nl/2013/02/top-3-ways-to-extract-images-from-word-docx-doc-document.html

In reply to Re: How to Extract all images from Microsoft Word File? by teun-arno
in thread How to Extract all images from Microsoft Word File? by prabudass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.