File: JiuCountColors.java

package info (click to toggle)
java-imaging-utilities 0.14.3-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,556 kB
  • sloc: java: 31,233; python: 71; xml: 31; makefile: 26; sh: 5
file content (30 lines) | stat: -rw-r--r-- 821 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * JiuCountColors
 * 
 * Copyright (c) 2007 Marco Schmidt.
 * All rights reserved.
 */
package net.sourceforge.jiu.apps;

import net.sourceforge.jiu.color.analysis.Histogram3DCreator;
import net.sourceforge.jiu.data.RGB24Image;
import net.sourceforge.jiu.gui.awt.ToolkitLoader;

/**
 * Small example command line program to count the number of
 * unique colors in image files.
 * @author Marco Schmidt
 * @since 0.14.2
 */
public class JiuCountColors
{
	public static void main(String[] args) throws Exception
	{
		String[] FILE_NAMES = {"jiu-hello-world.png", "resources/images/image1.jpg", "out-image1.jpg"};
		for (int i = 0; i < FILE_NAMES.length; i++)
		{
			RGB24Image image = ToolkitLoader.loadAsRgb24Image(FILE_NAMES[i]);
			System.out.println(FILE_NAMES[i] + "\t" + Histogram3DCreator.count(image));
		}
	}
}