Introduction: Photographic Quilt and Auto-generation Program
This instructable will take you from a photograph to a sophisticated, collated quilt pattern. In this instructable, we'll just go as far as creating the pattern. We'll photograph the progress of the quilt and post another instructable when it's complete. Errica [sic] has already done a few squares and you can really see how well it's going to come together!
- CoelPhotoPaint or another bitmap manipulation program. (I didn't have much luck with Paint.net, but you can give it a try!)
- The Python script included in this instructable.
Step 1: Select an Image
The first step in making a photographic style quilt is to find an image. This can be tricky! You will have to zoom in very close and find an image without a lot of detail if you want to have any hope of conveying your idea on a quilt. You should iterate on a *lot* of images before settling on your final one. We took several trips around the neighborhood taking photos of all the flowers we could find. Then we finally had the brilliant idea to visit the local nursery for flowers :-)
Take lots of photos. Make the close up, and make sure your background looks good. Here is a quick sample of the photos we took!
Step 2: Reduce the Resolution
Reduce the number of pixels. Be careful! A small change in resolution makes for a LOT more work: 10x10 = 100 squares, 20x20=400 squares, 40x40=1600 squares! A LOT of work to be sure.
Errica [sic] went bonkers and went for this image you see here, which is 39 x 47 = 1833 separate quilt pieces!
From this point on, be sure to save your images in .BMP format so that you don't loose any color information in encoding or decoding.
To reduce the number of pixels in the image, you choose Image->Resample. Be sure to change measurements to pixels, and specify around 40 pixel resolution. See photo for an example.
Step 3: Reduce the Number of Colors, Check Out Your Palette
Using CorelPhotoPaint or similar program, you can reduce the number of colors in the image. Use the 'Image->Convert to Paletted' command. I tried this in Paint.net with Posterize, but it resulted in WAY too many colors. The CorelPhotoPaint works well, and I'm sure this can be done in photoshop.
I choose the settings shown in the image. Basically, play with it until you get something you like. I ended up with 30 colors.
Here's the output of the color count:
$ ./count_colors.py 01-flower4-reduced_pixel_count.bmp 02-flower4-reduced_colors.bmp
There are 1827 colors in this image, and 1833 pixels:
There are 30 colors in this image, and 1833 pixels:
So, we reduced the image from 1827 colors to 30 colors! This is a good thing ;-)
Check out your palette for any colors that are too close to one-another. If any are very close, you can keep reducing the color count.
Step 4: Run This Program That Creates the Quilt!
Now, create the quilt pattern!
The attached program called create_quilt.py requires python with the Python Image Library.
You simply run the create_quilt.py program from your command line. If you are actually going to create one of these quilts and you don't have any clue how to run python or programs, just shoot me a message and run the program for you to create your palette and quilt pattern. If many people want to do it, I'll just stick it on a web page somewhere.
# create_quilt.py my_reduced_pixel_filename.bmp
and the follwoing files will be created:
The next couple of steps will describe each of those output files.
[UPDATE May 31, 2013: Added the create_quilt.zip file that contains the python script, as well as a stand alone windows executable for running the program.]
Step 5: Palette
Here is the palette.png output of create_quilt.py. This image will have one square for each color in your image. This is going to be your guide for selecting fabrics.
Each square is labeled in a "A, B" format. A is the index of the color, B is the number of square of that color required. In this example, the top left is a light pink, and it says, "0, 36". That means that the color index is '0', and there are 36 of these squares needed. As you go across the image, you see that the color index simply increments by one each square. (Sorry I started the quilt indices at 0, not one, which often confuses non programmers... oh well. Just remember that '0' is a number ;-) )
Step 6: Quilt.png
The quilt.png file shows an image of the entire quilt. This is your pattern that you will use to actually piece together your quilt.
The outsides of the pattern simply have the rows and columns numbered, and the number inside each quilt block represents the color index from your palette. Building your quilt is 'simply' quilting by number :-)
Step 7: Color_list.txt
Here's an example of the first few lines of color_list.txt:
# count RGB
0 36 [246, 215, 226]
1 62 [243, 143, 176]
2 65 [240, 111, 146]
3 55 [218, 157, 159]
The format is simply 'index count RGB color'. You can use this if you like, but really the previous photos are all that's required.
Step 8: Pick Your Fabrics
Print out your swatches and a large copy of your main image. Be careful that your swatch colors and main image colors match! We initially tried printing swatches at the photo place on 4x6 prints because they were $0.19 each with each swatch on a different print. The auto-color-correction wrecked that idea -- several of the colors that should be different came out looking identical! Be careful to double check the colors of everything before you start buying fabrics.
This is the end of the beginning. We'll keep you updated as the quilt progresses!
Stay tuned for instructable #2, where my wife actually builds the quilt. I only did the programming & helped with image selection, so my work here is done.
Step 9: Sneak Preview
Here's a sneak preview of the quilt. It's already starting to look cool!
Again, I'd be happy to run the little program for anybody that needs me to.