Page 1 of 1

sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T09:20:41-07:00
by RCinSTP
I am trying to get this image so there are just the simple basic color and lines, etc., and eliminate the "fuzzziness" between colors. For example, the pale blue represents lakes and that should be all one color, the line around the pale blue, should be a darker blue. I am trying to get a distinct colors, not all the pixels of blue between the pale and the darker.

https://goo.gl/photos/GDd26WTjVChqRTMw5

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T09:35:46-07:00
by fmw42
Use an interactive color picker to select the main colors you want to have preserved. Make a colortable image as an appended image of each color as a pixel. Use -dither none -remap with the colortable image to process your image. See http://www.imagemagick.org/Usage/quantize/#remap

Code: Select all

convert -size 1x1 xc:"color1" xc:"color2" ... xc:"colorN" +append colortable.png
convert image -dither none -remap colortable.png result

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T10:18:27-07:00
by RCinSTP
Thank you! I can use an interactive color picker and get the various colors, but how do I make an appended image of each color? Do I use GIMP to create the appended image?

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T10:53:42-07:00
by fmw42
The first convert command above in my previous post is creating the appended colors to make the colortable. You just supply as many
xc:"color" arguments as needed as indicated by the ... xc:"colorN".

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T12:05:45-07:00
by RCinSTP
On the first line I get an error message "missing an image filename", so I changed the line as below:
convert c:\myimage.jpg xc:"bbd5fa" xc:"d3e0c6" +append c:\colortable.png
but, I no matter how colors I add, I always get an error message: "unrecognized color 'd3e0c6'
the last part of the error message has whatever color is the last color in the command line.
I also tried as below using colorN and substituting the N for the number of colors, but I also get an error message with tha.
convert c:\myimage.jpg xc:"bbd5fa" xc:"d3e0c6" cx:"color2" +append c:\colortable.png

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T12:09:37-07:00
by fmw42
try this, with no input image.

Code: Select all

convert -size 1x1 xc:"color1" xc:"color2" ... xc:"colorN" +append colortable.png
Also hex colors must start with # as in #FF0000 for red

see http://www.imagemagick.org/script/color.php

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T12:28:55-07:00
by RCinSTP
Thank you for the clarification, that worked, I was able to create the colortable.png file. For the second line,when I write it as below, I get an error message: "unable to open image 'none': No such file or directory"

Code: Select all

convert c:\test.jpg -dither none -remap colortable.png c:\test\result.jpg

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T12:33:48-07:00
by fmw42
That does not make sense. It should work. try

Code: Select all

convert c:\test.jpg +dither -remap colortable.png c:\test\result.jpg
Perhaps you need to put the full path to the colortable.png image. Seems you may have written it to some other directory from where you are running the script.

To make life simpler, I generally run the convert command from the directory where I have all my images, so that I do not have to use full paths. So change directories to where you have both test.jpg and colortable.png. The just run the command with only the file names. If you want the result in some other directory, then use the full path for that.

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T12:51:19-07:00
by RCinSTP
I put the images in the same directory as IM and then wrote the command line as below:

Code: Select all

convert test.jpg -dither none -remap colortable.png converted.jpg
but, I still get the error message, "unable to open image 'none'

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T13:50:35-07:00
by fmw42
Did you try +dither rather than -dither none. If that does not work, post your command for creating the colortable.png image and I will try to process it.

What version of IM are you using? If old, then perhaps upgrade. Note that -remap used to be -map. So if you have a very old IM version, try -map rather than -remap.

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T13:58:14-07:00
by snibgo
RCinSTP wrote:unable to open image 'none'
What version of IM are you using? If older than 6.9.0, I suggest you upgrade.

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T14:16:32-07:00
by RCinSTP
I downloaded the latest version of IM and installed it and put the test.jpg and colortable.png in the IM folder and the error message still shows the IM is expecting "none" to be a filename. Perhaps "none needs a minus or plus sign in front of it or something?

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-02T15:41:35-07:00
by fmw42
RCinSTP wrote:I downloaded the latest version of IM and installed it and put the test.jpg and colortable.png in the IM folder and the error message still shows the IM is expecting "none" to be a filename. Perhaps "none needs a minus or plus sign in front of it or something?
No, it should work.

Post your command to create the colortable image and I will test both commands.

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-03T15:49:05-07:00
by glennrp
If you succeed in getting what you asked for, you'll probably be disappointed in how "jaggy" the transitions between the light blue and dark blue become.
For example,

Code: Select all

convert test.jpg +dither -colors 15 test-c15+d.png
reduces the colors set to 15 colors, doesn't dither, and produces an image with jaggy lakeshores, contour lines, and numbers. Since you are starting with an image that has already been dithered and converted to JPEG, I don't know how to do much better. Are you wanting to have the final result in JPEG also? If so, try

Code: Select all

convert test.jpg +dither -colors 15 -quality 92 test+d-c15-q92.jpg
Try other small values for "-colors". For this image, "-colors 8" works fairly well.

Re: sharpen / eliminate fuzziness in .jpg

Posted: 2015-10-03T19:52:05-07:00
by RCinSTP
I apologize, it has been sometime since I have worked with ImageMagick and I didn't realize that there is a version for Windows 64-bit, with full install. I finally figured this out, installed the correct version and now the commands are working fine.
I have many 256x256 pixel image tiles, similar to this image. I am trying to clean up these images so that I can convert them to vector images which I can then convert to a map for a GPS. The GPS map program only works with vector images. I'm using Vector Magic and the results are not quite good enough, that is why I am trying to clean up the images before converting them to vector. I've heard of potrace but my understanding is that it only works with black and white images.
http://vectormagic.com/