-lat doesn't give binary image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
inwelkin@gmail.com
Posts: 8
Joined: 2015-03-13T14:35:09-07:00
Authentication code: 6789

-lat doesn't give binary image

Post by inwelkin@gmail.com »

I have a jpg image that I want to do lat on.
The command I ran is following: convert img.jpg +compress -colorspace Gray -lat 17 img_lat.tif
The output image is grayscale, instead of binary. Please see the images at the links.
https://drive.google.com/file/d/0B1YGJ1 ... sp=sharing
https://drive.google.com/file/d/0B1YGJ1 ... sp=sharing
Please advice!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -lat doesn't give binary image

Post by fmw42 »

try

-lat 17x17+X%

where X is larger than zero.

If you use 0, then it will not seem to do the lat. If X is too small, you will get a lot of noise.

This seems OK to me, but you can vary the X.

Code: Select all

convert Image_01.jpg +compress -colorspace Gray -lat 17x17+5% img_lat.tif

What version of IM and what platform are you using?
inwelkin@gmail.com
Posts: 8
Joined: 2015-03-13T14:35:09-07:00
Authentication code: 6789

Re: -lat doesn't give binary image

Post by inwelkin@gmail.com »

-lat 17x17+1% gives binary output. Thanks a lot! Any suggestions why the difference?
I am using IM-6.7.8 on linux.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -lat doesn't give binary image

Post by fmw42 »

If you use 0, then it will not seem to do the lat. If X is too small, you will get a lot of noise.

This seems OK to me, but you can vary the X.

Code: Select all

convert Image_01.jpg +compress -colorspace Gray -lat 17x17+5% img_lat.tif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -lat doesn't give binary image

Post by fmw42 »

If you want to see more solid regions, then make your window size (17) larger. Try 25x25 and see the difference. If the window is larger than the largest region, then all of them should be more solid.
inwelkin@gmail.com
Posts: 8
Joined: 2015-03-13T14:35:09-07:00
Authentication code: 6789

Re: -lat doesn't give binary image

Post by inwelkin@gmail.com »

Yes, I increased the window size to 35. Looks good. Out of curiosity: why is lat not appropriately performed when input X is omitted?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -lat doesn't give binary image

Post by fmw42 »

I do not know for sure, but I assume the default is 0. I can only assume that is a bug. But using 0 will produce too much noise anyway and so not terribly useful. You can report that on the Bugs forum if you wish.
Post Reply