Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-10-21T11:55:19-07:00
try this using -depth 8
Code: Select all
infile="fifty.pdf"
convert "$infile[0]" -depth 8 -background white -flatten -alpha off -negate -threshold 0 \
-define connected-components:verbose=true -connected-components 8 null: |\
tail -n +2 | while read line; do
bbox=`echo "$line" | sed 's/^[ ]*//' | cut -d\ -f2`
color=`echo "$line" | sed 's/^[ ]*//' | cut -d\ -f5`
#echo "bbox=$bbox; color=$color;"
if [ "$color" = "srgb(255,255,255)" ]; then
convert "$infile[0]" -crop "$bbox" +repage result.png
break
fi
done
ggoutfitters
Posts: 8 Joined: 2016-10-10T12:27:26-07:00
Authentication code: 1151
Post
by ggoutfitters » 2016-10-24T06:29:29-07:00
Awesome, works great!
Thank you!!!
anthony
Posts: 8883 Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Post
by anthony » 2016-10-26T16:50:35-07:00
I have always has an interest in extracting the non-vector components (raster images) of a PDF file in there 'native' density.
As you should know resizing any raster image always results in a loss of quality, Thus my interest.
A quick google search found "pdfimages" from the "xpdf" package does exactly that!