jmagick

How can i find dominant color of an image?

不羁岁月 提交于 2019-11-27 11:44:01
问题 Can we find which color is dominant in an image with using java,imagemagick or jmagick? 回答1: in java iterate on each pixel and determine color import java.awt.image.BufferedImage; import java.io.File; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream;