Slashdot is powered by your submissions, so send in your scoop


Forgot your password?

Software to Divide an Image Into Discrete Patterns 109

slashyslashy asks: "My preschooler son is fond of color-by-number pages. We have already exhausted most of the online sites that offer somewhat limited sets of coloring pages that he can print to a paper and color. Besides, most of them offer extremely basic (read boring) sets of simple images (flowers, dinosaurs, etc). We were wondering if we can take any regular picture image and convert it into a pattern suitable (divide up the black and white picture into series of random patterns) for color-by-number pages. Is there any good software that allows converting a picture to a pattern suitable for coloring by numbers? Linux is preferable but Windows is also fine. Thank you."
This discussion has been archived. No new comments can be posted.

Software to Divide an Image Into Discrete Patterns

Comments Filter:
  • Jesus H Christ (Score:5, Insightful)

    by Monkelectric ( 546685 ) <> on Friday June 30, 2006 @10:37PM (#15641122)
    Just goto the 99 cent store and get him some books. Not everything needs to involve a computer
    • Re:Jesus H Christ (Score:5, Interesting)

      by bcat24 ( 914105 ) on Friday June 30, 2006 @10:51PM (#15641171) Homepage Journal
      This is Slashdot, a geek site. Of course the submitter could just go to the store and buy some books, but where's the fun in that? Maybe just wants to see if it's possible to do it himself.
    • Re:Jesus H Christ (Score:3, Interesting)

      by CastrTroy ( 595695 )
      Yeah seriously. You could probably get a book of 100 pages for around $1.00. That's cheaper than printing out the pages on even a laser printer, not even talk about the cost of inkjet printers. Not to mention that it's a lot easier to just pick up a book that's already there then go print something from the computer every time. Although I think the computer would be nice, as it could be used for whichever images he wanted. On a completely unrelated note, he could even encourage him to draw some of his
    • Re:Jesus H Christ (Score:2, Insightful)

      by Anonymous Coward
      Are those books going to have personal pictures? You know, something a little extra that the family can have fun with. No? That's what I thought.

      Fucking asshole.
    • The reason I originally started programming was that my father, sick of going to the store every day for maze books, implemented Kruskal's algorithm on his Smokestack machine and cranked up the dot matrix. That day was the first day I understood automation.

      Sometimes parents have less-than-obvious reasons.
  • by ptbarnett ( 159784 ) on Friday June 30, 2006 @10:40PM (#15641134)
    It's discrete [], not discreet [].
  • by Anonymous Coward
    I don't care what other people think of my patterns. Yeah, that's right, I'll Fourier transform whatever I damn well please. You prudes can go stuff it.
  • Possible approach... (Score:4, Interesting)

    by Sam Nitzberg ( 242911 ) on Friday June 30, 2006 @10:40PM (#15641137)
    This could be wrong, and it could be like trying to kill an ant with a sledgehammer, but here's a possible approach.
    A program like photoshop with lug-ins and image processing / manipulation capabilities may do the job.

    Scan an image, and using a combination of options such as color-reduction, "mattisify" (or others, e.g. Bas-Relief, etc), etc... may produce an acceptable result.

    Good luck

    • A program like photoshop with lug-ins and image processing / manipulation capabilities may do the job.
      It's called The GIMP []. Duh. :)
    • Emboss finds the edges (and turns everything else gray). If you start with "simple"
      enough images (GIFs with large solid polygons, not JPEG photos) then you ought to
      get good results. All that remains is to globally replace the dull gray fill.

      If on Win32, InfranView can do Embossing for you.
    • I would go for an edge-detection method, like a Sobel mask. One might also try to reduce the bit depth to find continuous color areas before doing this, but it may also produce artifacts in the image as such an operation may create blocks that otherwise weren't there.

      Edge-detection usually produces the edge areas in white and others in black, so you will want to negate that image, and perhaps do more bit-depth reduction to get away with the greys. Perhaps a sharpen?
  • It's easy to write but no one has done it. First take an image and do a histogram for it. Chose the "n" most common colors with certain restrictions of course. Then simply put a number in the center of the region. Also take the gradient of the image and add it, make em black, and then add to the original to find the borders.
    • pimpin' aint easy (Score:4, Informative)

      by weierstrass ( 669421 ) on Saturday July 01, 2006 @12:15AM (#15641448) Homepage Journal
      >It's easy to write but no one has done it.

      It's actually, both mathematically and computationally, a very difficult problem.
      Image Segmentation []
      I'm sure if you know how to do it, and write a nice paper, those folks will be very interested though..

      A tip: most things that are obvious problems that 'no one has done' are actually quite difficult if you think about them for more then 10 seconds.
      • From the linked page:

        A central problem, called segmentation, is to distinguish objects from background

        It's for a kid's colouring book. I don't think it has to be that accurate.

        • The problem is in provide a discreet definition for subjective and inuitive judgements. I work my own computer vision program as a hobby, and the biggest hurdle is in defining what exactly is a "thing." Take a scene of a park. The hills may have soft shadows around their curves, where does the light green end and the dark green begin when the border is blurred across 50 pixels? What about rational constructs such as a tree? Abstractly it would just be a field of green with bushy edges, but in actuallit
        • think again
      • As always we do tend to write about what we know, not about what someone asked us.

        Therefore, I am going to do the same.
        Segmentation in "need pictures for my kid" and "medical use" are way different. While procedures described above (Gimp, Photoshop,...) work fine, detection and use parts of 2D/3D/4D datasets in medical and similar purpouses is way more complex. Today, You can see nice images from big vendors of medical equipment (Siemens, GE, Phillips, Toshiba, Hitachi,...) but all of the images that You ca
      • Yeah, when I read the headline "divide an image into discrete patterns", I was reminded of the 'Applied Probability Course' [] offered by One of the lecturers appearantly did a PhD thesis on this topic. So, I was kind of impressed that some father would be interested in going to such lengths for his kid. (IIRC, there were only 5 lectures for the course, so you could certainly watch them if your interested in this subject.)

        Tip: Most 'hard' problems have really nifty approximate solutions that
  • by CrazyJim1 ( 809850 ) on Friday June 30, 2006 @10:53PM (#15641176) Journal
    When I was a kid, Dinosaurs were really cool.
  • Quick (Score:5, Informative)

    by labratuk ( 204918 ) on Friday June 30, 2006 @10:59PM (#15641199)
    Open inkscape []. Drag image in. Select imported image. Go Path -> Trace bitmap. You'll probably want to use the 'multiple scanning' options. Probably with fewer than the default 8 scans. Select created vectors. Open the fill & stroke dialog and set it to 'no fill' and a plain black stroke.

    As always, you'll want to play with parameters to get good results.
    • Better to use the program that's based off of. Would mean you could process a few hundred images at a time, in batch mode at the command line. Forget what the name of it is, but it's on sourceforge, and the name of it (with credits) are in the dialog.
    • Downloaded it and tried it. What is a "Pango" Error? It said something about fonts, too, and promplty crashed. I couldn't get it to open at all.

      • Downloaded it and tried it. What is a "Pango" Error? It said something about fonts, too, and promplty crashed. I couldn't get it to open at all.

        Get it from you distributor (Ubuntu, debian ,gentoo, SuSE or whatever.) Pango is a font managing system GTK uses, so the errors are probably related.

        Here it runs perfectly (Kubuntu). Awsome program... with the pace GIMP has these days, and Inkscape, and Blender.... all I need is the abilility to draw :)

        • I'm using Windows 98SE over here... and it was the Windows version I downloaded. I didn't see anything about it specifically requiring XP or anything. Oh well. I uninstalled it.

  • Saving Money (Score:3, Insightful)

    by WindozeSux ( 857211 ) on Friday June 30, 2006 @11:04PM (#15641212)
    If you want to save money and have a picture of anything you want, you could draw one for him or encourage him to be creative to make his own. I always liked being creative when I was younger(and I still do).
  • There used to be some jigsaw puzzle generators that allowed you to specify basic types of shapes, which might obscure the picture you are "jigsawing" enough to entertain a preschooler.
  • Google it (Score:5, Informative)

    by quaker5567 ( 841639 ) on Friday June 30, 2006 @11:24PM (#15641268)
    Search Google for "color by numbers software" [] Is it really that hard?
    • Re:Google it (Score:3, Informative)

      by pixelfood ( 973282 )
      I downloaded the free trial of this product, and the company was either brave or stupid to offer a free trial.
    • I do not see any numbers in the resulting image on the home page.
      It doesn't seem to be more advanced than what you can do with "detect edges" feature in your favorite paint program.
  • If you have the macromedia suite and basic knowledge of flash you can. (Not the easiest or cheapest way to go but it works...)

    In Macromedia Flash you can Trace Bitmap and it will tranform it to a vector image. Select each color piece, remove the fill and add a stoke color (to give it a border around it.) Add numbers and you are done, happiness!!!
  • image magick (Score:3, Informative)

    by blackcoot ( 124938 ) on Friday June 30, 2006 @11:30PM (#15641298) [] is free, runs on most any platform you'd ever case to use, and implements fuzzy c-means for image segmentation (which basically turns regular photos into "coloring book" versions of themselves). the c-means segmentation may be a bit too coarse for what you want to do. in that case, implementing a mean-shift segmenter (google for comaniciu and meer) will probably do a nice job. hope this helps!
    • I was just going to suggest this. You can even map all the colors to a new color scheme if you want. You could choose the exact number of colors you'd like to use. It's also very fast and scriptable.
  • Two Options... (Score:5, Informative)

    by WhyCause ( 179039 ) on Friday June 30, 2006 @11:31PM (#15641301)
    First, The Gimp makes something like this pretty easy. Open an image and go to 'Image -> Mode -> Indexed...', select the Generate Optimized Palette, and select the number of colors you want to use (10 might last your son 5 minutes, 200 might last him four years). Turn dithering off and hit OK. Next, go to 'Image -> Mode -> RGB' to switch it back to RGB color, then go to 'Filters -> Artistic -> Cartoon...', tweak the settings (Mask radius=10 and Percent black=1.0 seem to work), and hit OK. With these two, I was able to get a 'completed-looking' color-by-numbers image from a photo in about 10 seconds. The rest is up to you (I would start by selecting by color, getting the black outlines, and copying them into a new layer. Add in numbers and a legend, and you're good to go). If you want to get fancy, you could use some python-jitsu and whip up some script-fu to do it automagically.

    Second, you can keep it hardcore and use a program like NIH Image [] (or its PC counterpart, ScionImage []) and use a procedeure called thresholding to get different levels of black and white from an image. The program is scriptable, and if you google around enough (or poke through the sample scripts) you might be able to hack something together pretty easily. I've used this software to track points glued onto soft tissues (ligaments), and if I recall correctly, it was fairly easy to get it to do this sort of thing (i.e., Biomedical Engineering undergrads were able to get it to work). N.B. This is a serious research-level program, so it is not super user-friendly. I also doubt you'll find anything in the help forums if you search for color-by-number. Search instead for thresholding.

    The first option is likely to be waaay easier than the second.
    • I'll add to the parent by pointing out that if you go into Filter->Blur->Selective Gaussian Blur, with radius of 5-10 and Max Delta of around 92-128, before converting to index mode then you will end up with bigger-rounder shapes, like what you normally see in a color-by number. Afterwords, the easiest way to get rid of the color and be left with only the black outline is to go into Image->Colors->Threshold, and slide the left slider almost all the way to the left.
      • Oops, that should have been Layers->Colors->Threshold.

        Also I realized that the cartoon filter may be troublesome if one of the indexed colors in your picture is black. Here is an alternate procedure:

        * Filter : Blur : Selective Gaussian Blur, with radius of 5-10 and Max Delta of around 16-128 (depending on how textured image is)
        * Image : Mode : Index, with Generate Optimum Palette of 5 - 20 colors
        * Image : Mode : RGB
        * Filters : Edge-Detect : Sobel (vertical and horizontal)
        * Layers : Colors : Invert
        * La
    • NIH Image has been superseded by ImageJ []. And am I really the only one who knows the definitions of discreet [] and discrete []?????
  • Photoshop! (Score:5, Informative)

    by Peganthyrus ( 713645 ) on Friday June 30, 2006 @11:37PM (#15641329) Homepage
    It's called Photoshop.

    1. image->adjustments->posterize
    2. filter->stylize->find edges
    3. image->adjustments->desaturate
    4. image->adjustments->levels, pull the leftmost triangle all the way to the right

    You can skip the first step, but then it'll be reeeeally complex.

    You might also want to scale your images up a lot before processing them.

    Or you could use autotrace tools like Streamline, or the "LiveTrace" feature built into Illustrator.

    Or you could pop up another layer over it and trace the image by hand, then turn off the original image layer and print it out.

    Or, yeah, you could just go buy some coloring books, they're reeeeeeally cheap!
    • Or, yeah, you could just go buy some coloring books, they're reeeeeeally cheap!

      Cheap but not free, like the GIMP. So, let's try what you just did with five thousand dollars worth of software.

      1. Get an interesting image (work warning!) with a right click "edit with Gimp" from your favorite browser.
      2. Filters>Artistic>Cartoon. Adjust to the level of black you want.
      3. Layers>Colors>Posterize. Choose the number of colors that suits you.

      Woops, now it's just a cartoon that's already been colored. W

      • So, let's try what you just did with five thousand dollars worth of software.

        Photoshop is definitely worth five thousand dollars but luckily it only costs around 600$ ;)
      • Woops, now it's just a cartoon that's already been colored. Well, you get the idea.

        At least you recognize that what you accomplished in two steps is not the same thing as what the OP accomplished in four. He took the color out. You didn't. I bet I can make the GIMP do in 1 step something that takes Photoshop a dozen, as long as they're two different things.

        And as another poster mentioned, Photoshop isn't anywhere near 5 grand. In fact, the OP's method can be done with Elements, which comes free with
        • >> Woops, now it's just a cartoon that's already been colored. Well, you get the idea.
          > At least you recognize that what you accomplished in two steps is not the same thing
          > as what the OP accomplished in four. He took the color out. You didn't.

          Okay, how about:

          - Filters>Artistic>Cartoon. Adjust to the level of black you want.
          - Layers>Colors>Threshold. Set the number on the left equal to 1.

          And for better quality, it helps on some dark or noi
      • You're off by an order of magnitude; Photoshop's list price is $650. You're also not done!
    • It's called Photoshop.

      Or you can use the same steps with the GIMP, and save yourself $600, and run it on Linux.

      • Or you could use Photoshop Elements, which only costs $90 and isn't nearly as painful to use as GIMP's brain-dead interface. (Especially on OS X, where GIMP is a X11 app.)
        • Or you could use Photoshop Elements, which only costs $90 and isn't nearly as painful to use as GIMP's brain-dead interface.

          To each his own, I suppose. I vastly prefer the GIMP's interface over Photoshop's.

          (Especially on OS X, where GIMP is a X11 app.)

          I use the GIMP on OS X all the time. It doesn't look like everything else on the desktop, but it works just fine. It's certainly not a difference worth $90 to me.

          And the requested platform was Linux, which Elements doesn't support.

  • This program is supposed to be able to convert photos to color by number pictures, suitable for paint, crayon, etc. I haven't tried it, but it does have a free trial and is $19.95 to buy. []
    • O.K., I had my filtering level set too high, so I'll label my previous post redundant.

      In my defense, I think the original poster was looking for advice about software. After reading a lot of self-righteous pontification from various paragons of parenting wisdom and virtue, I was in a mad rush to help the O.P. find the requested software.

  • I don't know of particular packages, but try searching google for "image segmentation" programs. Most of it would be in scientific papers and such, but some of them usually have demo programs. You could also try searching for "paint by numbers".

    Wait, I think I found one. []
    Good luck.
  • by mnmn ( 145599 )
    Or the Adobe Element allows contrast search or something similar where it brings up the lines. In Emboss, you can further contrast the image to make it black n white. That should work. If you arent happy with the think boundary lines the elements tool (pretty sure theres something similar in linux) will give you sharp lines that you can contrast more. Of course only certain images will work, not everything.
  • Bitmap to Vector (Score:2, Insightful)

    by Joebert ( 946227 )
    Anyone know how Flashes bitmap to Vector translations work ?

    Maybe Illustrator.

    Vecotrization seems the way to go.
    • It was my first thought, too. Xara (Xtreme/X1/X/Studio/Artworks) has a similar function. Not sure whether it's in the Xara XL Linux beta.

      As with the other suggestions: trace the image (with a fairly large colour threshold, and possibly quite a lot of smoothing and de-noising), then select the whole result and give it a finite line width (depends on the size of the image, but not "thin") and no fill colour. The benefit of the tracing route is that - because the result is a vector - you can make a nice smooth
  • by toothfish ( 596936 ) on Saturday July 01, 2006 @01:34AM (#15641662) Journal
    Peter Selinger's Potrace [] could probably be a good start. He links to a dude [] who uses Potrace in conjunction with a few other tools to create stained glass. He also links to one of my projects, although he calls it pocopo instead of pacopo. I don't think that pacopo is what you're looking for although it may give you some ideas.

    • Last time I looked potrace was used by Inkscape for it's "trace bitmap" feature. I've had success vectorising images by doing "posterise" color (sic) reduction in GIMP, possibly doing some image smoothing too (oilify works quite well for this) - then importing into Inkscape and doing a trace.

  • I think what you need is an edge detection algorithm [] of some kind. Try FILTERS [].
  • ImageJ (Score:2, Informative)

    I would bet that ImageJ would do the job for you.

    It is multi-platform, fairly fast and has a number of plugins and macros. If you find a combination of operations that work well, you can save it as a macro that a kid could probably handle on their own.

    It is available at [].

    The website is rudimentary, but the program itself is fun to mess with.
  • Print the image out faintly, perhaps in grayscale, and let him trace and fill in the image himself. Computers just aren't that good at recognising the boundaries of objects in pictures; a preschooler could probably do a better job than a computer and it'll make it less "boring" for him too...
  • but why not go Tracing Paper -> Scanner -> Printer

    If the original images are starting off on the computer, just put an extra initial Printer stage in there.
  • by Anonymous Coward
    You'll find that there are quite a few programs and websites out there that will breakdown an image into areas of certain colors. They work really nicely. You'd just need to convert the cross stitch thread numbers to colors for your pre-schooler.
  • We are talking royalty free images here of course, correct?

Last yeer I kudn't spel Engineer. Now I are won.