We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I was looking for a way to segment the stickers into separate images. This script works for https://github.com/securingdev/awesome-stickers/blob/master/raw/attrition_01.pdf
#!/bin/sh input="$1" # verbose set -x if [ ! -f "$input" ]; then echo "File not found: $input" exit 1 fi background_color=$(convert "$input" -colors 32 -depth 8 -format "%c" histogram:info: | sort -r -n | awk '{print($4); exit;}') # avoid white if [ "$background_color" = "white" ]; then background_color="rgb(254,254,254)" fi echo "background_color: $background_color" convert "$input" +repage -alpha off \ -fuzz 5% -fill "$background_color" -opaque "$background_color" \ +dither -colors 32 \ -morphology dilate octagon \ -fuzz 0 -fill white +opaque "$background_color" -fill black +opaque white \ -type bilevel \ -define connected-components:exclude-header=true \ -define connected-components:verbose=true \ -define connected-components:area-threshold=5000 \ -connected-components 8 -auto-level lumps.png greys=$(convert lumps.png -colors 255 -depth 8 -format "%c" histogram:info: | awk '!/#000000/{print($3)}') mask=0 for grey in $greys; do convert lumps.png -fuzz 1% -fill black +opaque "$grey" -fill white -opaque "$grey" mask_${mask}.png mask=$((mask + 1)) done seg=0 rm -f segment_*png for f in mask_*png; do convert "$input" "$f" -compose copy-opacity -composite -trim +repage segment_${seg}.png seg=$((seg + 1)) done
The text was updated successfully, but these errors were encountered:
Discussion: ImageMagick/ImageMagick#2537
Sorry, something went wrong.
No branches or pull requests
I was looking for a way to segment the stickers into separate images.
This script works for https://github.com/securingdev/awesome-stickers/blob/master/raw/attrition_01.pdf
The text was updated successfully, but these errors were encountered: