This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes jpeg problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jpeg problems" Watch "jpeg problems" New topic

jpeg problems

colton peterson
Ranch Hand

Joined: Nov 18, 2007
Posts: 97

I am trying to make a very simple program that is like a coloring book. It takes a black and white outline of a picture from a jpeg and lets the user fill of the spaces with color like a coloring book. I don't know any practical way to do this. My original idea was to put it on a bufferedimage and edit pixel by pixel but this was to hard on the computer I am using. Any help would be appriciated
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
It sounds like the first step would be to create the outline from the image. I think you'd need a line-detection algorithm for that. If this is a color picture it might produce additional spurious lines where there aren't really any. Do you have experience with this kind of image processing?

The second part (letting the user fill the outline) sounds easier. If you search for "flood-fill algorithms" or some such, you should find descriptions of algorithms that do that. those rely on the araes being completely separated from each other, though, so the line detection step before would need to work very well.
colton peterson
Ranch Hand

Joined: Nov 18, 2007
Posts: 97

Thank you. I looked around and I think I have found something that will work.

If anyone else has a problem like this go to for some example code or to use. I avoided the line algorithm by using a black and white gif image
[ November 19, 2007: Message edited by: colton peterson ]
I agree. Here's the link:
subject: jpeg problems
It's not a secret anymore!