This might be a general imagemagick issue rather than perl-specific, but I'm using perl (and command-line convert)
So far, imagemagick thresholding is, at best, flaky for me, or even downright useless. Gimp's Colors->Threshold removes light-gray fuzz from my image, leaving just black and white pixels, with its default value of 127 (of max 255).
It would seem that
convert 50% in.jpg out.jpg
or
convert 32768 in.jpg out.jpg
or
$image->Threshold(threshold=>'50%')
would achieve the same thing -- remove the fuzz. But none of the above three are removing the fuzz.
I've also played with -white-threshold and -black-threshold, and it's just ineffective, for the stated objective.
Any suggestions?
thanks
annoying failure with thresholding
-
- Posts: 11
- Joined: 2012-03-19T06:05:50-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: annoying failure with thresholding
I do not use or know perl, but the above in not correct. It should beconvert 50% in.jpg out.jpg
convert in.jpg -threshold 50% out.jpg
-
- Posts: 11
- Joined: 2012-03-19T06:05:50-07:00
- Authentication code: 8675308
Re: annoying failure with thresholding
yup, sorry -- that was a typo on my part. I have been trying it with the CORRECT syntax, like the one you spelled out. What I said originally still stands -- the imagemagick thresholding does not remove light-gray fuzz. But the Gimp threshold DOES.fmw42 wrote:I do not use or know perl, but the above in not correct. It should beconvert 50% in.jpg out.jpg
convert in.jpg -threshold 50% out.jpg
thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: annoying failure with thresholding
can you provide a link to your image?
and tell us exactly what your command line is and what version of IM and platform you are using?
and tell us exactly what your command line is and what version of IM and platform you are using?
-
- Posts: 11
- Joined: 2012-03-19T06:05:50-07:00
- Authentication code: 8675308
Re: annoying failure with thresholding [SOLVED]
I solved my problem. It was the destination format. Duh! I was thresholding the original image and then saving it back to a jpg, with default compression quality that was re-introducing my gray pixelation !fmw42 wrote:can you provide a link to your image?
and tell us exactly what your command line is and what version of IM and platform you are using?
Two possible solutions, so far: make the destination format PBM or similar, or use 100% quality for the jpeg:
1) convert -threshold 50% in.jpg out.pbm
2) convert -threshold 50% -quality 100% in.jpg out.jpg
Both of the above work!
Haven't tried perlmagick, but am assuming it will work (if not, I'll post my rants here )