I gave a shot at this and came up with a solution. Probably not the best that can be made, but it works. The solution is based on @Alan Munn's answer.
It's a shell script that should work on all Unix systems with pdfLaTeX and pdfpages installed. You use it by giving it the file name of the TeX file (no .tex ending!) and the offset in pages (caused by front matter) as the second argument:
./only-figures.sh document 1
First we load the .aux and prepare to store it in a variable.
STR=$(cat $1.aux |\
We only care about the lines with figures.
grep figure |\
And of these lines we only care about the number referring to unique pages.
sed 's/.*}}{\([1-9]*\)}}/\1/' | uniq |\
We then add the offset to the page numbers.
awk '{print $0+'$2'}' |\
And finally pack them all up in a comma-separated list.
sed ':a;N;$!ba;s/\n/,/g')
A template file is used for the new temporary document.
cat template.tex | sed s/@@@/$STR/ > only-figures-tmp.tex
The template looks as following:
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages={@@@}]{document}
\end{document}
We call pdfLaTeX on the temporary file, move the new PDF and cleans up.
pdflatex only-figures-tmp
mv -f only-figures-tmp.pdf $1-only-figures.pdf
rm only-figures-tmp.*
The whole thing can also be found in this Gist