Color reduction (in Java)

I would like to find a way to get JPEG images (or GIF / PNG) and reduce the number of colors, for example. 20. Can someone recommend some library or other link? Source codes in other languages ​​are also welcome.

+1
source share
6 answers

Take a look at the Java Advanced Imaging API . This API implements several algorithms to reduce color.

+3
source

JAI (Java Advanced Imaging API) will do the job, but has some disadvantages.

The API is far from easy to use, especially if you care about the memory area ...

IMHO Java is not the best platform for image processing tasks. You can try ImageMagick , a great command line tool used by popular sites like Flickr. You can integrate ImageMagick into your Java application using the command line (Runtime.exec ()) or Jmagick , which is the Java bridge for ImageMagick

+2
source

This seems like a simple implementation in java based on ImageMagick:

http://gurge.com/amd/java/quantize/index.html

+1
source

Look for color quantization algorithms, especially the midline section. You will find many examples with these keywords. Libraries for this include ImageMagick , which has bindings for many languages. JMagick is a taste of Java.

0
source

Take a look at image filters at http://www.jhlabs.com/ip/filters/index.html . QuantizeFilter seems to do what you want.

0
source

The JAI API is the way to go. Currently, JVM performance is very close to assembler. I know that I did it.

-2
source

Source: https://habr.com/ru/post/893602/


All Articles