Created
November 11, 2018 11:45
-
-
Save pschild/846692964ea0b87b4b05efdae8523634 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert imgage.jpg +repage out.mpc | |
copy out.cache => in.cache | |
copy out.mpc => in.mpc | |
make backgroundcolor transparent and the rest red | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert in.mpc -fuzz 6% -fill none -bordercolor white -border 1x1 -draw "alpha 0,0 floodfill" -shave 1x1 out1.mpc | |
remove the background and replace the remaining image with red | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert out1.mpc -fuzz 6% -fill red +opaque none -background black -alpha background TMP2.mpc | |
for each... | |
Get color by x,y coordinate | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP2.mpc -channel rgba -alpha on -format "%[pixel:u.p{x,y}]" info: | |
example: & "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP2.mpc -channel rgba -alpha on -format "%[pixel:u.p{100,100}]" info: => red | |
When a red pixel is found, e.g. @100,100, floodfill it wiht white | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP2.mpc -channel rgba -alpha on -fill white -draw "color 100,100 floodfill" TMP3.mpc | |
fill all pixels that are not white with transparecncy and then turn transparency off so that all that is not white becomes black | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP3.mpc -channel rgba -alpha on -fill none +opaque white -alpha off TMP3A.mpc | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP3A.mpc -trim -fill white -opaque black TMP3B.mpc | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP3A.mpc TMP3B.mpc -flatten TMP4.mpc | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert imgage.jpg TMP4.mpc -compose multiply -composite -trim photo-1.jpg | |
ODER mit deskew | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert imgage.jpg TMP4.mpc -compose multiply -fuzz 6% -composite -trim -deskew 40% -trim +repage photo-1.jpg | |
remove the prcoessed red part | |
& "C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" convert TMP3.mpc -channel rgba -alpha on -fill none -opaque white TMP2.mpc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment