On Thu, 08 Jan 2009 11:48:38 +0100 Cedric Pinson <[email protected]> wrote:
| Hi Anthony, | | I will try to answer inline because i am not sure i understand all details | | | I dont understand why you are saying what i did is pure luck :) | because i put the original alpha mask of the original image on the final | because i dont want the alpha mask changed in final image. Are you | saying that | my use of morphology is not correct to expand the ? in this case i will | understand. | Could you send me your circle_halves.png in order i test with it to see | the result | | anyway if you have a morphology that dont touch the alpha mask it will | avoid me to extract | and copy the original image mask to the final alpha_mask. | | | Maybe i miss something, can you point me precisely where i am wrong ? | thank you for your helps and suggestion. | | Cheers, | Cedric | | Anthony Thyssen wrote: | > On Wed, 07 Jan 2009 21:01:13 +0100 | > Cedric Pinson <[email protected]> wrote: | > | > | Hi, | > | | > | Here the script i use it seems to work fine for all my cases right now, | > | i will try on futur data and tell if it works | > | for most cases | > | | > | #!/bin/bash | > | set -e | > | set -x | > | file=$1 | > | filewithoutext=$(echo $1 | sed 's/.png//g') | > | name=$(basename $1 | sed 's/.png//g') | > | ./morphology -m grayscale -t erode -i 1 $file /tmp/${name}_0.png | > | convert $file -alpha extract /tmp/${name}_alpha.png | > | composite -gravity center $1 /tmp/${name}_0.png /tmp/${name}_2.png | > | convert /tmp/${name}_2.png /tmp/${name}_alpha.png -alpha off -compose | > | Copy_Opacity -composite ${filewithoutext}_final.png | > | | > I can see the results your script produces using my "circle_halves.png" | > test image. though there appears to be a couple of unusual extraneous | > pixels. in the results. | > | Could you send me your picture in order i test please | > However I would not depend on morphology from expanding (or contracting) | > the image mask as you are using it for. What should do is undefined, | > and in fact logically it is doing the oppisite of what it should be doing. | > | Yes that's why i dont use the result of alpha mask from morphology i use | the original | because i want the mask not changed. But maybe i miss something in this | line: | | composite -gravity center $1 /tmp/${name}_0.png /tmp/${name}_2.png | | > The fact that it does so is pure luck. I just submitted back to Fred | > a improved and about 7 times faster version of grayscale morphology, | > however it does not erode/dilate the transparency mask of the image! | > | It's better for sure | > I suggest you extract the alpha mask first, the dilate it separatally. | > | that's why i do or again maybe my composite line i miss something. | > ASIDE: the new version also has the interative blur spreading operator | > that I developed in the previous email. | > | > I'll include a copy of that script to you. | > | > Fred.... Please note there is a small change to the previous one so this | > version does at least preverse transparency in greyscale morphology. The | > previous one wiped out transparency rather than preserve it. | > | > | If i understand correctly you are saying is for this line: | | composite -gravity center $1 /tmp/${name}_0.png /tmp/${name}_2.png | | /tmp/${name}_0.png should not have the mask extended from morphology is | that correct ? | or did i miss other thing ? | PS: both IM and morphology can use pipelines to pass images from one command into the next. for example... convert circle_halves.png -alpha extract miff:- | \ morphology -m grayscale -t dilate -i 5 - show: The '-' means read from stdin, 'show:' means display the result on screen and quit (leaving it displayed in background) without saving this 'test run' into a file. PPS: The circle_halves.png was given as an IM command in that long exploration I did in a previous mail.... I'll repeat it here... convert -size 100x100 xc:none \ -draw "fill magenta path 'M 30,60 A 1,1 0 0,0 70,40 z'" \ -draw "fill cyan path 'M 30,60 A 1,1 0 1,1 70,40 z'" \ -draw "fill blue circle 50,50 37,37'" \ circle_halves.png Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- To seek out strange, new Taglines to BOLDLY quote ... ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
