Results 1 to 10 of 10
Thread: Colouration Image
- 12-07-2012, 03:49 PM #1
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Colouration Image
Hi!
Does anyone know, how can i make program that will make colouration image?
Like this:

to example this:

or example this:

(made in Gimp)
Program will be transform entrance image to new image after user give main color new image.
I try make program with java.awt library, but i think it's very hard.
I started use JMagick, but i don't see right methods(with right filter).
You know suitable library or way to make this program? (I don't want finished solution, only help)
Greetings,
Rafał
PS: Sorry for my bad english.
- 12-07-2012, 06:23 PM #2
Re: Colouration Image
Are the images monochromatic? That is, do they contain different saturation/intensities of just one hue?
If so, you should be able to obtain the saturation/intensity (or brightness) values using a RGB to HSI /HSB convertor, then generate new RGB values after changing the Hue.
But before that, are you familiar with the BufferedImage API?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-07-2012, 06:39 PM #3
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Re: Colouration Image
I don't know. Images are in gif and png and they are on the website (background, bar, box). They have not many colour's. My job is to do the generator changing styles all pictures from pages for a specific color. With BufferedImage I can't do this. Colors don't change in simple way. It is like on this forum. They are dark blue bar, light blue bar etc. and i want change e.g. to dark green, light green and respectively.
Last edited by RafalD; 12-07-2012 at 06:42 PM.
- 12-08-2012, 03:28 AM #4
Re: Colouration Image
Do you know and understand the RGB / HSI / HSB color models? If you don't, then start by learning about them.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-08-2012, 09:15 AM #5
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Re: Colouration Image
RGB i know. HSB it's HSV? And HSI? You mean HSL? Overall, I do not know too much about the graphics.
Conversion and change of color I think might help. I had not thought about it, thanks.
I try it on Monday.
- 12-08-2012, 09:42 AM #6
Re: Colouration Image
Yup, HSL is also a good bet. (B=Brightness, I=Intensity, L=Luminance). A blog post by one of our members, camickr, should be useful: HSL Color « Java Tips Weblog
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-11-2012, 11:57 AM #7
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Re: Colouration Image
Another problem.
When I read a image with some transparent pixel I cann't read alfa. I use pixel.getAlpha() and always i get 255(inclusive pixel with real 0 alpha). In new image i can change alpha, but i don't know which pixels without information about their start alfa.
For example:
It:

is changed to:
- 12-11-2012, 04:10 PM #8
Re: Colouration Image
Unless you show us the code that reads the images*, I don't see how anyone can even try to help.
* preferably in the form of a SSCCE (Short, Self Contained, Correct (Compilable), Example) that downlads an image from the net and adequately demonstrates the problem.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-11-2012, 07:53 PM #9
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Re: Colouration Image
It is Code(shortened,cuted - program normaly make more, but it is not important):
And there are example images.Java Code:import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class generator { public static void main(String[] args) { String infilename = "img/graphist.gif"; String outfilename = "img/new_graphist.gif"; int ccolor; Color color; int width=0; int height=0; File inputFile = new File(infilename); File outputFile = new File(outfilename); BufferedImage graph = null; try { graph=ImageIO.read(inputFile); width=graph.getWidth(); height=graph.getHeight(); BufferedImage new_graph = new BufferedImage(width,height,BufferedImage.TYPE_4BYTE_ABGR ); for(int x=0;x<width;x++) { for(int y=0;y<height;y++) { ccolor=graph.getRGB(x,y); color=new Color(ccolor); new_graph.setRGB(x, y,(color.getRed() << 16)|(color.getGreen() << 8)|color.getBlue()|(color.getAlpha() << 24)); } } ImageIO.write(new_graph,"gif",outputFile); } catch (IOException e) { e.printStackTrace(); } } }
Oryginal: New image:

Earlier I change Alpha to 0 where are Red==64, green=255 and Blue==64, but it is not in all images.
- 12-13-2012, 05:33 PM #10
Member
- Join Date
- Dec 2012
- Posts
- 16
- Rep Power
- 0
Similar Threads
-
No SVG image preview in netbeans visual midlet screen <SVG image is not specified>
By pomi_jan in forum CLDC and MIDPReplies: 4Last Post: 12-07-2012, 11:44 AM -
How do I determine image size ahead of time when image has variable lines of text?
By mikemil in forum Java 2DReplies: 4Last Post: 08-09-2012, 06:18 PM -
How to import image, draw circles/text on it, and save a new image to disk
By InTheEndo in forum Java 2DReplies: 1Last Post: 07-28-2011, 08:48 AM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 05:29 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks