Re: find opacity of pixels alpha layer
Posted: 2017-03-16T10:04:20-07:00
That does what you want, does it?snibgo wrote:Oops, sorry. In my second command, change "-black-threshold" to "-threshold".
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=31582
That does what you want, does it?snibgo wrote:Oops, sorry. In my second command, change "-black-threshold" to "-threshold".
Code: Select all
convert \
test-image.png \
\( -clone 0 -background Red -layers flatten \) \
\( -clone 0 -alpha extract -threshold 30% \) \
-delete 0 \
-compose CopyOpacity -composite \
ti_30_r.png
What does "remove" mean? Do you want to make them fully transparent? Or do you want to crop the image, trimming those pixels from edges? Or what?wrote:... can we remove the pixels from the image ...
Code: Select all
convert 5bd84de35c7c8.png -bordercolor None -border 1 -trim +repage out.png
Code: Select all
convert 5bd84de35c7c8.png -bordercolor None -border 1 -trim +repage out.png
Code: Select all
exec('convert uploads/demo_selectionbb.png -background white -alpha background \( +clone -fill black -colorize 100 -fill white +antialias -draw "polygon 99,24 63,215 30,372 1,535 15,575 48,575 101,560 121,523 136,467 163,376 192,310 227,231 269,120 300,126 342,277 369,371 435,516 500,600 548,591 548,548 533,441 519,307 509,226 483,127 471,70 457,16 409,22 357,23 313,22 309,51 296,71 276,79 266,40 267,18 227,1 209,0 202,5 197,14 173,23 142,25 108,20" -alpha off \) -alpha off -compose copy_opacity -composite IM_result.png');
Code: Select all
convert \( demo_selection.png +repage -background black -alpha background \
\( +clone -fill black -colorize 100 -fill white +antialias \
-draw "polygon 99,24,63,215,30,372,1,535,15,575,48,575,101,560,121,523,136,467,163,376,192,310,227,231,269,120,300,126,342,277,369,371,435,516,500,600,548,591,548,548,533,441,519,307,509,226,483,127,471,70,457,16,409,22,357,23,313,22,309,51,296,71,276,79,266,40,267,18,227,1,209,0,202,5,197,14,173,23,142,25,108,20" -alpha off \) \
-alpha off -compose copy_opacity -composite \) \
\( pattern:checkerboard -resize 50x50 -write mpr:checks +delete \
+clone -tile mpr:checks -draw "color 0,0 reset" \) \
+swap -compose over -flatten result.png
Code: Select all
convert \( demo_selection.png +repage -background black -alpha background \( +clone -fill black -colorize 100 -fill white +antialias -draw "polygon 99,24,63,215,30,372,1,535,15,575,48,575,101,560,121,523,136,467,163,376,192,310,227,231,269,120,300,126,342,277,369,371,435,516,500,600,548,591,548,548,533,441,519,307,509,226,483,127,471,70,457,16,409,22,357,23,313,22,309,51,296,71,276,79,266,40,267,18,227,1,209,0,202,5,197,14,173,23,142,25,108,20" -alpha off \) -alpha off -compose copy_opacity -composite \) \( pattern:checkerboard -resize 50x50 -write mpr:checks +delete +clone -tile mpr:checks -draw "color 0,0 reset" \) +swap -compose over -flatten result.png