Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: adapting imagemagick background removal script to Magick.NET

$
0
0
Hi Dirk,

If for you, helping in imagemagick + main author of Magick.net, it takes several hourS ....
.. then it is out (for the moment) of my possibilities. I already spent days on other basic tasks with magick.net (the documentation ... well ... is far beyond the tons of possibilities to put it positively :) )

It is clear that the piping+scripting style of that IM script:
convert "$image" \
  \( -clone 0 $bgnd -compose Difference -composite \
     $grayscale \
     -channel B -evaluate 'set' 0 +channel \) \
  \( -clone 1 -fill blue -fuzz $fzout%  $fill \
     -channel B -separate +channel \) \
  \( -clone 1 -fill blue -fuzz $fzin%  $fill \
     -channel B -separate +channel -negate \) \
  \( -clone 2,3 -negate -compose multiply -composite \) \
  $showmasks \
  \( -clone 0,3 +matte -compose CopyOpacity -composite \) \
  \( -clone 1 -channel R -separate +channel \
     -clone 4 +matte -compose CopyOpacity -composite \
     \( +clone -blur 0x30 +matte \) +swap -compose Over -composite \
     +matte -normalize \
     -clone 4 -compose multiply -composite  \
     -background $background -alpha shape \
     -clone 5 -compose over -composite \) \
  -delete 0--2 "$image_out"
is much more complicated when done operation by operation in c# style. I was not even sure if all these operations were implemented in your Library. Are they btw ?

My current approach was basically :
image.FloodFill(System.Drawing.Color.Transparent, 0, 0);
applied on 1 to 4 corners. So
  • Do you see a better method, with some code ?
    OR
  • Do you see with the floodfill, how I can smooth the edges ? (because it fact if works already good except the hard transition - so "simply" being able to put some pixel of transition would just make it very very good). Any line of code for that ?
Thanks, for your help,
Fabrice

Viewing all articles
Browse latest Browse all 3693

Trending Articles