text:
Paint a still life (or a moving one) - draw an image in the Game of Life
You are given as input a greyscale image. Your task is to find a static or looping pattern in Conway's Game of Life that resembles the input image as closely as possible.
Your output can be either a still image or a looping animation in some format that can be converted to gif. The output image dimensions should be the same as the input, and it must contain only black and white pixels.
If the output is an animation, each frame must be generated from the previous one according to the Game of Life rules, with one cell per pixel. The animation must loop, with the first frame being generated from the last frame by the same rules.
If the output is a still image, applying the game-of-life rules to it must produce the same image. This means that no 'alive' cell may have more than three or less than two 'alive' neighbours, and no 'dead' cell may have exactly three 'alive' neighbours. (Note that this is basically the same as an animation as described above, but with only one frame.)
Extra rules and clarifications:

You (or your program) may choose whether 'alive' cells are represented as white and 'dead' as black, or vice versa. That is, you can either hard-code this or your program can choose it based on the input image. (But it must be the same for every frame of the animation.)
The boundary conditions should be periodic, meaning that cells on the rightmost column have neighbours on the leftmost column, etc.
For animations, the frame rate is up to you (or your program); I imagine fast frame rates will work well for approximating grey pixels.
Please post at least two results embedded in your answer. If you can post results from all of the input images below, it's preferable.
It is acceptable to scale down the test images if this is necessary in order to achieve gifs with small enough file sizes. If you want to link to larger files as well, that's fine. If you want to show off, feel free to find some higher-resolution source files.
Please try to avoid having too many controllable parameters in your code - it's best if your program's only input is the image. The exception is if you want to have a parameter for controlling the number of animation frames, since that will affect the file size.
You may use external programs to change the format of the input and output files, and/or compile output frames into an animation if you want. (This is not a file-format-handling challenge.)
This is popularity-contest, so the answer with the most votes wins.

Here is a selection of test images, mostly taken from other questions on this site. (It's possible that I will add additional "bonus" input images later.)

Just to get things started, here's a very dumb reference attempt in Python 2, which takes advantage of the fact that a block of four squares is a stable structure in the Game of Life. It just rescales the input image by a factor of 4, then draws a block if the corresponding pixel is darker than 0.5.
from skimage import io
from skimage import transform
import sys

img = io.imread(sys.argv[1],as_grey=True)

source = transform.resize(img, [i/4 for i in img.shape])

img[:]=1
for x in xrange(source.shape[0]):
    for y in xrange(source.shape[1]):
        if source[x,y]<0.5:
            img[x*4, y*4] = 0
            img[x*4+1, y*4] = 0
            img[x*4, y*4+1] = 0
            img[x*4+1, y*4+1] = 0

io.imsave(sys.argv[2], img)

Here are some outputs from the example code. I'm sure that much better results are possible.

Here's some high density still life segments: http://en.wikipedia.org/wiki/Still_life_(cellular_automaton)#Maximum_density. You can't get more than density 1/2 in the limit.

In your example, aren't new cells born at the junction of three squares?

@xnor oh yes, you're right. I'd better remove the example for now in that case. (I should also start writing some verification code!)

@xnor I fixed it at the expense of making the image quality even worse. It's only an example after all.

Fun challenge! Contestants may want to be aware of the concept of a "Garden of Eden" configuration in the Game of Life. That is, there are some configurations which cannot be generated by any predecessor state. http://en.wikipedia.org/wiki/Garden_of_Eden_(cellular_automaton)

Not sure how that would help, since none of the garden of eden patterns are still lives. (which would make them their own predecessor) Similar reasoning for why they are not oscillators either.

@Tally: True, I was thinking of the garden of eden patterns as a counter-example in case someone wanted to search for predecessor-states. But I can see I was overcomplicating the approach :-)

BTW just how far would you allow people to scale down their images?
I have an idea consisting of large amounts of gliders and reflectors to create "pixels".

@Tally it's "popularity contest", so I'll leave that up to the voters. But note that the way it's written at the moment, the output image does have to have the same dimensions as the input image, so if you use a small input image you'll have to give a small output as well. Of course there's nothing stopping you taking a large input image and then scaling out down inside your program if you want to work with bigger pixels.

Some further inspiration for contestants: http://tlrobinson.net/blog/2009/02/game-of-life-generator/

I'm adding this to my list of questions to hopefully answer in the near future.

I made a version using hill climbing algorithm and JAX https://avinayak.github.io/algorithms/programming/2021/02/19/finding-mona-lisa-in-the-game-of-life.html

Python
import sys, random, itertools
from PIL import Image

filename, cutoff = sys.argv[1], int(sys.argv[2]) if len(sys.argv) > 2 else 128

# load command-line arg as image
src = Image.open(sys.argv[1]).convert("L") # grayscale
(w, h), src = src.size, src.load()
# flatten
src = bytearray(src[x, y] for y in range(h) for x in range(w))
size = len(src)
neighbour_offsets = (-w-1,-w,-w+1,-1,1,w-1,w,w+1)

shapes = set()
max_shape_x, max_shape_y = 0, 0
for shape in (((1, 1), (1, 1), "b"), # block
    ((0,1,1,0),(1,0,0,1),(0,1,1,0), "h"), # hive
    ((0,0,1,0),(0,1,0,1),(1,0,0,1),(0,1,1,0), "l"), # loaf
    ((0,1,0),(1,0,1),(0,1,0), "t"), # tub
    ((1,1,0),(1,0,1),(0,1,0), "B"), # boat
    ((1,1,0),(1,0,1),(0,1,1), "s"), # ship
    ((1,1,0,1,1),(0,1,0,1,0),(0,1,0,1,0),(1,1,0,1,1), "I"), # II
    ((0,0,0,1,1),(0,0,0,0,1),(0,0,0,1,0),(1,0,1,0,0),(1,1,0,0,0), "c"), # canoe sinking
    ((1,1,0,0),(1,0,0,1),(0,0,1,1), "a"), # aircraft carrier
    ((0,1,1,0,0),(1,0,0,1,0),(0,1,0,0,1),(0,0,1,1,0), "m"), # mango
    ((0,1,1,0),(1,0,0,1),(1,0,0,1),(0,1,1,0), "p"), # pond
    ((0,0,0,1,1),(0,0,1,0,1),(0,0,1,0,0),(1,0,1,0,0),(1,1,0,0,0), "i"), # integral
    ((1,1,0,1),(1,0,1,1), "S"), # snake
    ((1,1,0,0),(1,0,1,0),(0,0,1,0),(0,0,1,1), "f"), # fish hook
    ):
    X, Y = len(shape[0]), len(shape)-1
    max_shape_x, max_shape_y = max(X, max_shape_x), max(Y, max_shape_y)
    shapes.add(((X, Y), tuple(y*w+x for y in range(Y) for x in range(X) if shape[y][x]), shape[:-1], shape[-1]))
    shapes.add(((X, Y), tuple(y*w+x for y in range(Y) for x in range(X-1,-1,-1) if shape[y][x]), shape[:-1], shape[-1]))
    shapes.add(((X, Y), tuple(y*w+x for y in range(Y-1,-1,-1) for x in range(X) if shape[y][x]), shape[:-1], shape[-1]))
    shapes.add(((X, Y), tuple(y*w+x for y in range(Y-1,-1,-1) for x in range(X-1,-1,-1) if shape[y][x]), shape[:-1], shape[-1]))

def torus(i, *indices):
    if len(indices) == 1:
        return (i + indices[0]) % size
    return [(i + n) % size for n in indices]

def iter_neighbours(i):
    return torus(i, *neighbour_offsets)

def conway(src, dest):
    for i in range(size):
        alive = count_alive(src, i)
        dest[i] = (alive == 2 or alive == 3) if src[i] else (alive == 3)

def calc_score(i, set):
    return 255-src[i] if not set else src[i]

def count_alive(board, i, *also):
    alive = 0
    for j in iter_neighbours(i):
        if board[j] or (j in also):
            alive += 1
    return alive

def count_dead(board, i, *also):
    dead = 0
    for j in iter_neighbours(i):
        if (not board[j]) and (j not in also):
            dead += 1
    return dead

def iter_alive(board, i, *also):
    for j in iter_neighbours(i):
        if board[j] or (j in also):
            yield j

def iter_dead(board, i, *also):
    for j in iter_neighbours(i):
        if (not board[j]) and (j not in also):
            yield j

def check(board):
    for i in range(size):
        alive = count_alive(board, i)
        if board[i]:
            assert alive == 2 or alive == 3, "alive %d has %d neighbours %s" % (i, alive, list(iter_alive(board, i)))
        else:
            assert alive != 3, "dead %d has 3 neighbours %s" % (i, list(iter_alive(board, i)))

dest = bytearray(size)

if False:
    # turn into contrast
    for i in range(size):
        mx = max(src[i], max(src[j] for j in iter_neighbours(i)))
        mn = min(src[i], min(src[j] for j in iter_neighbours(i)))
        dest[i] = int((0.5 * src[i]) + (128 * (1 - float(src[i] - mn) / max(1, mx - mn))))
    src, dest = dest, bytearray(size)

try:
    checked, bad, score_cache = set(), set(), {}
    next = sorted((calc_score(i, True), i) for i in range(size))
    while next:
        best, best_score = None, sys.maxint
        current, next = next, []
        for at, (score, i) in enumerate(current):
            if score > cutoff:
                break
            if best and best_score < score:
                break
            if not dest[i] and not count_alive(dest, i):
                do_nothing_score = calc_score(i, False)
                clean = True
                for y in range(-max_shape_y-1, max_shape_y+2):
                    for x in range(-max_shape_x-1, max_shape_x+2):
                        if dest[torus(i, y*w+x)]:
                            clean = False
                            break
                    if not clean:
                        break
                any_ok = False
                for (X, Y), shape, mask, label in shapes:
                    for y in range(Y):
                        for x in range(X):
                            if mask[y][x]:
                                pos, ok = torus(i, -y*w-x), True
                                if (pos, label) in bad:
                                    continue
                                if clean and (pos, label) in score_cache:
                                    score = score_cache[pos, label]
                                else:
                                    paint = torus(pos, *shape)
                                    for j in paint:
                                        for k in iter_alive(dest, j, *paint):
                                            if count_alive(dest, k, *paint) not in (2, 3):
                                                ok = False
                                                break
                                        if not ok:
                                            break
                                        for k in iter_dead(dest, j, *paint):
                                            if count_alive(dest, k, *paint) == 3:
                                                ok = False
                                                break
                                        if not ok:
                                            break
                                    if ok:
                                        score = 0
                                        any_ok = True
                                        for x in range(X):
                                            for y in range(Y):
                                                score += calc_score(torus(pos, y*w+x), mask[y][x])
                                            score /= Y*X
                                        if clean:
                                            score_cache[pos, label] = score
                                    else:
                                        bad.add((pos, label))
                                if ok and best_score > score and do_nothing_score > score:
                                    best, best_score = (pos, shape, label), score
                if any_ok:
                    next.append((score, i))
        if best:
            pos, shape, label = best
            shape = torus(pos, *shape)
            sys.stdout.write(label)
            sys.stdout.flush()
            for j in shape:
                dest[j] = True
            check(dest)
            next += current[at+1:]
        else:
            break
except KeyboardInterrupt:
    pass
print

if True:
    check(dest)
    anim = False
    while dest != src:
        if anim:
            raise Exception("animation!")
        else:
            anim = True
        sys.stdout.write("x"); sys.stdout.flush()
        conway(dest, src)
        dest, src = src, dest
        check(dest)

# canvas
out = Image.new("1", (w, h))
out.putdata([not i for i in dest])

# tk UI
Tkinter = None
try:
    import Tkinter
    from PIL import ImageTk
    root = Tkinter.Tk()
    root.bind("<Button>", lambda event: event.widget.quit())
    root.geometry("%dx%d" % (w, h))
    show = ImageTk.PhotoImage(out)
    label = Tkinter.Label(root, image=show)
    label.pack()
    root.loop()
except Exception as e:
    print "(no Tkinter)", e
    Tkinter = False

if len(sys.argv) > 3:
    out.save(sys.argv[3])

if not Tkinter:
    out.show()

Please squint:

The code stamps on the whitest pixels with the best-fitting standard still life.  There's a cut-off argument so you get to decide were the rounding to black-white threshold goes.  I've experimented with living-is-white and the outcome is much the same.

It's best to include your code in your post, and to title your post with the language name. e.g. #Python

My validator script says you have some bad pixels at the left and right edges. It looks like when pixels wrap around from right to left, they also move one pixel downwards.

+1 though - thanks for the very quick answer!

@Nathaniel thx for introducing me to implementing GoL.  A fairly straightforward misunderstanding.  The output would be much the same and I have no lust to wait for them to render all over again :(  This challenge has the same flaw as my own animation one - people really imagine they want to see the results, but it takes far to much investment to actually enter.  The complexity space of this particular problem makes the http://azspcs.net contests look tame.  Its a shame that GoL is monochrome and, to be honest, a poor fit for still images.  SmoothLife seems fun; but not for drawing pics with.

@Will no need to worry about fixing the bug, I just felt compelled to mention it since I'd gone to the trouble of writing a program to check it!

@Nathaniel yeah it was a rookie mistake and obvious in hindsight.  A bit hampered by the fact I implemented it as a 1D array.  Pypy renders much faster but it still takes too long.  To do decent dithering you'd need to work at much much higher resolution etc.

Inspired by this contest: https://gist.github.com/williame/494ed07fcadb53aebe9b download it, put the grayscale mona.png in the same folder, and view in firefox.  (Chrome will need you to serve it over http).  Its not pretty nor thought-through like SmoothLife, its just box smoothing without clamping so too dark becomes light again.

Java
An edge-detection-based approach. Requires this text file in the running directory.
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.*;

import javax.imageio.ImageIO;

public class StillLifer{
    private static List<boolean[][]>patterns=new ArrayList<>();
    private static boolean[][] copy(boolean[][]b,int x,int y){
        boolean[][]r=new boolean[6][6];
        for(int i=0;i<6;i++){
            for(int j=0;j<6;j++){
                r[i][j]=b[y+i][x+j];
            }
        }
        return r;
    }
    private static void paste(boolean[][]from,boolean[][]to,int x,int y){
        for(int i=0;i<from.length;i++)for(int j=0;j<from[0].length;j++){
            to[y+i][x+j]=from[i][j];
        }
    }
    private static boolean[][]findClosest(boolean[][]b){
        boolean[][]c=null;
        int d=999999;
        for(boolean[][]k:patterns){
            int d2=editDistance(b,k);
            if(d2<d){
                c=k;
                d=d2;
            }
        }
        return c;
    }
    private static boolean[][]decode(String s){
        char[]a=s.toCharArray();
        boolean[][]r=new boolean[6][6];
        int k=0;
        for(int i=0;i<6;i++){
            for(int j=0;j<6;j++){
                r[i][j]=a[k++]=='1';
            }
        }
        return r;
    }
    private static class EdgeDetectEntry{
        int l;
        int x;
        int y;
        public EdgeDetectEntry(int m,int x,int y){
            this.l=m;
            this.x=x;
            this.y=y;
        }
    }
    private static Random rand;
    private static int w,h;
    private static BufferedImage img;
    private static boolean[][]grid;
    private static File file;
    private static int editDistance(boolean[][]from,boolean[][]to){
        int w=from.length;
        int h=from[0].length;
        int k=0;
        for(int x=0;x<w;x++){
            for(int y=0;y<h;y++){
                k+=from[y][x]^to[y][x]?1:0;
            }
        }
        return k;
    }
    private static int colorDistance(Color from,Color to){
        return from.getRed()-to.getRed();
    }
    private static int edgeDetectWeight(int x,int y){
        int k=0;
        Color c=new Color(img.getRGB(x, y));
        for(int x2=Math.max(0,x-1);x2<Math.min(w,x+2);x2++){
            for(int y2=Math.max(0,y-1);y2<Math.min(h,y+2);y2++){
                int l=colorDistance(c,new Color(img.getRGB(x2, y2)));
                k+=l*l;
            }
        }
        return k;
    }
    private static void save() throws Exception{
        int bk=Color.BLACK.getRGB();
        int wt=Color.WHITE.getRGB();
        for(int x=0;x<w;x++){
            for(int y=0;y<h;y++){
                img.setRGB(x,y,grid[y][x]?wt:bk);
            }
        }
        String k=file.getName().split("\\.")[0];
        ImageIO.write(img,"png",new File(k="out_"+k+".png"));
    }
    private static String rle(boolean[][]grid){
        StringBuilder st=new StringBuilder();
        for(boolean[]row:grid){
            for(int j=0;j<row.length;j++){
                int k=1;
                for(;j<row.length-1&&row[j]==row[j+1];j++)k++;
                if(k!=1)st.append(Integer.toString(k,36));
                st.append(row[j]?'@':'-');
            }
        }
        return st.toString();
    }
    private static int getVal(boolean[][]grid,int x,int y){
        if(x<0)x+=w;
        if(y<0)y+=h;
        if(x==w)x=0;
        if(y==h)y=0;
        return grid[y][x]?1:0;
    }
    private static boolean newState(boolean[][]grid,int x,int y,String rule){
        String[]r=rule.split("/");
        int k=0;
        for(int a=-1;a<=1;a++)for(int b=-1;a<=1;a++)k+=(a|b)==0?0:getVal(grid,x+a,y+b);
        String s=Integer.toString(k);
        return grid[y][x]?r[1].contains(s):r[0].contains(s);
    }
    private static boolean[][] next(boolean[][]grid,String rule){
        boolean[][]r=new boolean[h][w];
        for(int x=0;x<w;x++){
            for(int y=0;y<h;y++){
                r[y][x]=newState(grid,x,y,rule);
            }
        }
        return r;
    }
    private static void loadPatterns() throws Exception{
        Scanner reader=new Scanner(new File("lib.txt"));
        while(reader.hasNext()){
            String line=reader.nextLine();
            if(line.startsWith("--"))continue;
            patterns.add(decode(line));
        }
        reader.close();
    }
    public static void main(String[]a) throws Exception{
        loadPatterns();
        Scanner in=new Scanner(System.in);
        img=ImageIO.read(file=new File(in.nextLine()));
        in.close();
        w=img.getWidth();
        h=img.getHeight();
        grid=new boolean[h][w];
        final int npix=w*h;
        rand=new Random(npix*(long)img.hashCode());
        List<EdgeDetectEntry> list=new ArrayList<>();
        for(int x=0;x<w;x++){
            for(int y=0;y<h;y++){
                list.add(new EdgeDetectEntry(edgeDetectWeight(x,y),x,y));
            }
        }
        list.sort((one,two)->{int k=two.l-one.l;if(k>0)return 1;if(k<0)return -1;return 0;});
        for(int i=Math.max(Math.min(3,npix),npix/5);i>0;i--){
            EdgeDetectEntry e=list.get(i);
            grid[e.y][e.x]=rand.nextDouble()<0.9;
        }
        grid=next(grid,"/2345678");
        boolean[][]d=new boolean[h][w];
        for(int i=0;i<w/6;i++){
            for(int j=0;j<h/6;j++){
                paste(findClosest(copy(grid,i*6,j*6)),d,i*6,j*6);
            }
        }
        grid=d;
        assert(rle(next(grid,"3/23")).equals(rle(grid)));
        save();
    }
}

Some results:

C++
Straightforward pixelation approach using the average of each 8x8 grid to select an 8x8 output grid (a "color texture").  Each 8x8 output grid has a 2 cell separator at the top and right.  Grids were designed ranging from 4 cell still lifes to 18 cell still lifes within the remaining 6x6 pixels.
The program acts as a filter from binary PGM to binary PBM.  By default, images are "dark"; black is death and white is life; -i inverts this.  -g [value] adds a gamma, which is used to pre-weight averages before selecting the color textures.
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>

// colors 4 through 18 have 4 through 18 live cells
// colors 1-3 are repetitions of 0 or 4 used
// as artificially weighted bins
unsigned char gol_colors[]={
      0,  0,  0,  0,  0,  0,  0,  0 // Color  0
   ,  0,  0,  0,  0,  0,  0,  0,  0 // Color  1
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  2
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  3
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  4
   ,  0,  0,  0, 24, 40, 16,  0,  0 // Color  5
   ,  0,  0,  0, 16, 40, 80, 32,  0 // Color  6
   ,  0,  0,  0, 48, 72, 40, 16,  0 // Color  7
   ,  0,  0,  8, 20,  8, 64,160, 64 // Color  8
   ,  0,  0,  8, 20,  8, 64,160, 96 // Color  9
   ,  0,  0, 12, 20,  8, 64,160, 96 // Color 10
   ,  0,  0, 12, 20,  8,192,160, 96 // Color 11
   ,  0,  0,204,204,  0,  0, 48, 48 // Color 12
   ,  0,  0,204,204,  0,192,160, 64 // Color 13
   ,  0,  0,  0,108,168,168,108,  0 // Color 14
   ,  0,  0, 96,144,104, 40,172,192 // Color 15
   ,  0,  0,204,204,  0,  0,204,204 // Color 16
   ,  0,  0,216,216,  0,216,212,  8 // Color 17
   ,  0,  0,204,164, 40, 80,148,204 // Color 18
};

enum { gol_bins = sizeof(gol_colors)/(sizeof(*gol_colors))/8 };

bool inverted=false;

bool applygamma=false;
double gammasetting=0.0;

unsigned int corrected(unsigned int i, unsigned int r) {
   return static_cast<unsigned int>(r*std::pow(i/static_cast<double>(r), gammasetting));
}

int main(int argc, char** argv) {
   std::vector<unsigned short> pgm_data;
   unsigned pgm_width;
   unsigned pgm_height;
   unsigned pgm_vpp;

   std::vector<unsigned char> pbm_data;
   unsigned pbm_width;
   unsigned pbm_height;

   unsigned int doublings=0;

   std::vector<std::string> args(argv+1, argv+argc);
   for (unsigned int i=0, e=args.size(); i<e; ++i) {
      if (args[i]=="-i") { inverted=true; continue; }
      if (args[i]=="-g") {
         if (i+1==e) continue;
         std::stringstream ss;
         ss << args[++i];
         if (ss >> gammasetting) applygamma = true;
         continue;
      }
   }

   std::string line;
   std::getline(std::cin, line);
   if (line!="P5") return 1;
   enum { nothing, have_w, have_h, have_bpp } readstate = nothing;
   while (std::cin) {
      std::getline(std::cin, line);
      if (line.empty()) continue;
      if (line[0]=='#') continue;
      std::stringstream ss; ss << line;
      for(;;) {
         switch (readstate) {
         case nothing: if (ss >> pgm_width) readstate = have_w; break;
         case have_w:  if (ss >> pgm_height) readstate = have_h; break;
         case have_h:  if (ss >> pgm_vpp) readstate = have_bpp; break;
         }
         if (readstate==have_bpp) break;
         if (ss) continue;
         break;
      }
      if (readstate==have_bpp) break;
   }
   if (readstate!=have_bpp) return 1;
   // Fill pgm data
   pgm_data.resize(pgm_width*pgm_height);
   for (unsigned i=0, e=pgm_width*pgm_height; i<e; ++i) {
      int v = std::cin.get();
      if (v==std::char_traits<char>::eof()) return 1;
      pgm_data[i] = static_cast<unsigned int>(std::char_traits<char>::to_char_type(v))&0xFFU;
   }
   pbm_width  = pgm_width/8*8;
   pbm_height = pgm_height/8*8;
   pbm_data.resize(pbm_width*pbm_height/8);
   for (unsigned x=0, xe=pbm_width/8; x<xe; ++x) {
      for (unsigned y=0, ye=pbm_height/8; y<ye; ++y) {
         // Calculate the average of this 8x8 area
         unsigned int total=0;
         for (unsigned int xd=0; xd<8; ++xd) {
            for (unsigned int yd=0; yd<8; ++yd) {
               unsigned int c = x+xd+(y+yd)*pgm_width;
               unsigned int pv = pgm_data[x*8+xd+(y*8+yd)*pgm_width];
               // Apply gamma prior to averaging
               if (applygamma) pv=corrected(pv, pgm_vpp);
               total += pv;
            }
         }
         total /= 64;
         // Invert average if inverting colors (white on black)
         if (inverted) total=pgm_vpp-total;
         total *= gol_bins;
         total /= (pgm_vpp+1);
         // Fill 8x8 areas with gol color texture
         for (unsigned int yd=0; yd<8; ++yd) {
            pbm_data[x+(y*8+yd)*pbm_width/8] = gol_colors[total*8+yd];
         }
      }
   }
   // Now, write a pbm
   std::cout
      << "P4\n"
      << "# generated by pgm2gol\n"
      << pbm_width << " " << pbm_height << "\n";
   for (unsigned i=0, e=pbm_data.size(); i<e; ++i) {
      unsigned char data=pbm_data[i];
      if (!inverted) { data=pbm_data[i]^0xFF; }
      std::cout.put(data);
   }
}

Selected results (note: all pbm's were converted to png's using a third party program for upload):
Escher, gamma 2.2

Mona Lisa, gamma 2.2

Ocean, gamma 2.2 inverted

Puppy, gamma 2.2

Treachery of Images, gamma 2.2 inverted

Mona Lisa gamma 2.2, inverted, for comparison


text:
Tension on a Graph, Part II: A Rubber Band
This is the second of two challenges about "pulling functions taut". Here is the slightly simpler Part I.
Let's drive m nails into a board at positions (x1, y1) to (xm, ym). Tie a rubber band to the first and last of those and stretch around the other nails, such that the band traverses all nails in order. Note that the rubber band now describes a piecewise linear parameterised function (x(t), y(t)) in 2D space.
Now drive another n nails into the board, at positions (x1, y1) to (xn, yn). If we now remove all of the original m nails except the first and last one (which the ends of the rubber is tied to), the rubber band will shorten until it's lying taut around the new nails, yielding another piecewise linear function.
As an example, take m = 12 initial nails at positions (0, 0), (2, -1), (3/2, 4/3), (7/2, 1/3), (11/2, 16/3), (1, 16/3), (0, 1), (7, -2), (3, 4), (8, 1), (3, -1), (11, 0), and n = 10 further nails at positions (1, 1), (3, 1), (4, 4), (1, 3), (2, 2), (5, -1), (5, 0), (6, 2), (7, 1), (6, 0). The following three plots show the process described above:

For larger version: Right-click --> Open in new tab
And here is an animation of the rubber band tightening if you have some difficulty visualising it:

The Challenge
Given two lists of "nails", plot the taut rubber band around the second list if it starts from the shape traversing all the nails in the first list.
You may write a program or function and take input via STDIN, ARGV or function argument. You can either display the result on the screen or save an image to a file.
If the result is rasterised, it needs to be at least 300 pixels on each side. The final rubber band and nails must cover at least 75% of the horizontal and vertical extent of the image. The length scales of x and y have to be the same. You need to show the nails in the second set (using at least 3x3 pixels) and the string (at least 1 pixel wide). You may or may not include the axes.
Colours are your choice, but you need at least two distinguishable colours: one for the background and one for the nails and the string (those may have different colours though).
You may assume that all nails in the second list are at least 10-5 units away from initial shape of the rubber band (so that you don't need to worry about floating-point inaccuracy).
This is code golf, so the shortest answer (in bytes) wins.
More Examples
Here are two more examples:
{{1, 1}, {3, 3}, {2, 4}, {1, 3}, {4, 0}, {3, -1}, {2, 0}, {4, 2}}
{{2, 1}, {3, 2}, {1, 2}, {4, 1}}

{{1, 1}, {3, 1}, {3, 3}, {1, 3}, {1, 5}, {3, 5}, {-1, 3}, {-1, 0}, {3, 4}, {5, 1}, {5, -1}, {7, -1}, {3, 7}, {7, 5}}
{{0, 0}, {0, 2}, {0, 4}, {0, 6}, {2, 0}, {2, 2}, {2, 4}, {2, 6}, {4, 0}, {4, 2}, {4, 4}, {4, 6}, {6, 0}, {6, 2}, {6, 4}, {6, 6}}

And here is one example that shows the significance of two of the initial nails remaining. The result should be b and not a:
{{0, 0}, {0, 1}, {-1, 1}, {-1, -1}, {1, -1}, {1, 0}}
{{-0.5, 0.5}}

Thanks to Ell for providing this example.

@laurencevs The string one is single-valued, which considerably simplifies things, because there's an obvious direction in which to process function and nails. This one may contain loops and zigzags, and the form of the function is considerably different (and variable), which means that the solutions should be considerably different.

What's the output of this?

@Ell Ah, very nice test case. I suppose for consistency, it should be b, but I really need to clarify the question about that. Will do that soon. Thanks!

Python + matplotlib, 688
from pylab import*
C=cross
P,M=eval("map(array,input()),"*2)
P,N=[[P[0]]+L+[P[-1]]for L in P,M]
W=[.5]*len(P)
def T(a,c,b):
 I=[(H[0]**2,id(n),n)for n in N for H in[(C(n-a,b-a),C(n-b,c-b),C(n-c,a-c))]if(min(H)*max(H)>=0)*H[1]*H[2]]
 if I:d=max(I)[2];A=T(a,c,d);B=T(d,c,b);return[A[0]+[d]+B[0],A[1]+[sign(C(c-a,b-c))]+B[1]]
 return[[]]*2
try:
 while 1:
    i=[w%1*2or w==0for w in W[2:-2]].index(1);u,a,c,b,v=P[i:i+5];P[i+2:i+3],W[i+2:i+3]=t,_=T(a,c,b);t=[a]+t+[b]
    for p,q,j,k in(u,a,1,i+1),(v,b,-2,i+len(t)):x=C(q-p,c-q);y=C(q-p,t[j]-q);z=C(c-q,t[j]-q);d=sign(j*z);W[k]+=(x*y<=0)*(x*z<0 or y*z>0)*(x!=0 or d*W[k]<=0)*(y!=0 or d*W[k]>=0)*d
except:plot(*zip(*P))
if M:scatter(*zip(*M))
show()

Reads two lists of points from STDIN.
Example
[(0, 0), (2, -1), (3.0/2, 4.0/3), (7.0/2, 1.0/3), (11.0/2, 16.0/3), (1, 16.0/3), (0, 1), (7, -2), (3, 4), (8, 1), (3, -1), (11, 0)]
[(1, 1), (3, 1), (4, 4), (1, 3), (2, 2), (5, -1), (5, 0), (6, 2), (7, 1), (6, 0)]

How it works
The key to the solution is to work in small, incremental steps.
Instead of trying to figure out what happens when we remove all the nails at once, we concentrate on the direct effects of removing just a single nail.
We can then remove the nails one by one in an arbitrary order.
Working incrementally means that we must keep track of the intermediate state of the rubber band.
Here's the tricky part: merely keeping track of which nails the band runs through is not enough.
During the process of removing nails the band can get wound and later unwound around a nail.
Therefore, when the band interacts with a nail we must keep track of how many times and in what direction it wraps around it.
We do it by assigning a value to each nail along the band like so:

Note that:

We start counting as soon as the band is tangent to the nail, even though the nail doesn't strictly affect its shape.
Recall that, unlike the illustration, our nails are dimensionless.
Therefore, if the band becomes tangent to a nail we can't tell which side of the band the nail is on by its position alone---we must keep track of where it used to be relative to the band.
We keep around nails with a value of zero, that is, nails that used to, but no longer hold the band, instead of removing them right away.
If we did, it could trigger an unwelcomed chain reaction, while we're trying to keep the effects of each step localized.
Instead, nails with a value of zero are considered eligible for removal as part of the bigger process.

Now we can describe what happens at each step:

We select a nail to remove from the band's current path.
A nail is eligible for removal if it's part of the first set of nails (save for the endpoints) or if its value is zero.
Pretending that the two neighboring nails are fixed, we figure out which nails from the second set or the pair of endpoints the band is going to run through once the selected nail is removed (we don't bother with the rest of the nails from the first set, since they'll eventually all be removed.)
We do it in a similar fashion to the solution to Part I.
All these nails are on the same side of the band, hence we assign to all of them a value of 1 or -1, depending on the side.
We update the value of the two neighboring nails to reflect the changes to the band's path (easily the trickiest part!)

This process is repeated until there are no more nails to remove:

And here's a more complicated example illustrating the band wrapping around a nail several times:

Amazing! Just one thing: are those graphics rasterised or are they vector graphics? In the former case, I'll have to point you to "The length scales of x and y have to be the same." Also, what are you using to create all those graphics you use in your explanations. matplotlib, too?

Thanks! Err... Since matplotlib let's me scale the plot on the fly I'm gonna go with vector graphics :) For the illustrations I use mostly GeoGebra. It's a little quirky but it gets the job done.

Yeah okay, if you can resize it arbitrarily, that's fine. Thanks for the link, I'll check that out!

Java - 1262 bytes
I know this is probably not golfed as much as it could be.
However, no one else seems to be stepping up to the plate and answering this question, so I will.
First, class "T" - which is a point class - 57 bytes
class T{double x,y;public T(double a,double b){x=a;y=b;}}

And the main class - 1205 bytes
import java.awt.Color;import java.awt.Graphics;import java.util.*;import javax.swing.*;class Q extends JPanel{void d(List<T>a,T[]z){JFrame t=new JFrame();int m=0;int g=0;for(T v:a){if(v.x>m)m=(int)v.x;if(v.y>g)g=(int)v.y;}for(T v:z){if(v.x>m)m=(int)v.x;if(v.y>g)g=(int)v.y;}t.setSize(m+20,g+20);t.setVisible(true);t.getContentPane().add(this);double r=9;while(r>1){r=0;for(int i=0;i<a.size()-1;i+=2){T p1=a.get(i),p2=new T((p1.x+a.get(i+1).x)/2,(p1.y+a.get(i+1).y)/2);a.add(i+1,p2);if(y(p1,p2)>r){r=y(p1,p2);}}}double w=15;List<T>q=new ArrayList<T>();while(w>3.7){w=0;q.clear();for(int e=0;e<a.size()-2;e++){T p1=a.get(e),u=a.get(e+1),p3=a.get(e+2),p2=new T((p1.x+p3.x)/2,(p1.y+p3.y)/2);w+=y(u,p2);int k=0;if(y(p1,a.get(e+1))<.5){a.remove(e);}for(T n:z){if(y(n,p2)<1){k=1;q.add(n);}}if(k==0){a.set(e+1,p2);}}}q.add(a.get(a.size()-1));q.add(1,a.get(0));p=z;o=q.toArray(new T[q.size()]);repaint();}T[]p;T[]o;double y(T a,T b){return Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2));}public void paintComponent(Graphics g){if(o!=null){for(int i=0;i<o.length-1;i++){g.drawLine((int)o[i].x,(int)o[i].y,(int)o[i+1].x,(int)o[i+1].y);}g.setColor(Color.blue);for(T i:p){g.fillOval((int)i.x-3,(int)i.y-3,6,6);}}}}

Example:

To run, call the "d" function with a List of points and an array of nails (yeah, I know, weird).
What it does:

creates a list of points that represent the lines - that is, all the points in between the lines.
repeats an algorithm repeatedly to these points so that the each point is the average of the two points around it.
When the points don't seem to be moving much anymore, I draw between any nails that they are touching.

I am not sure if axes in pixels is ok. It will always take up more than 75% of the space, it might just be really, really small.
Here is a nice animation to demonstrate what I'm doing here:

Eventually, it becomes this, in which the points are barely moving. This is when I see what nails it is touching:

Here is the ungolfed, animation code:
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Q extends JPanel{
    List<Point>points=new ArrayList<Point>();
    List<Point>n=new ArrayList<Point>();
    public Q() throws InterruptedException{
        double[][]rawPoints={{0, 0}, {2, -1}, {3/2, 4/3}, {7/2, 1/3}, {11/2, 16/3}, {1, 16/3}, {0, 1}, {7, -2}, {3, 4}, {8, 1}, {3, -1}, {11, 0}};
        double[][]rawNails={{1, 1}, {3, 1}, {4, 4}, {1, 3}, {2, 2}, {5, -1}, {5, 0}, {6, 2}, {7, 1}, {6, 0}};
        List<Point>p=new ArrayList<Point>(),nails = new ArrayList<Point>();
        double factor = 50;
        for(double[]rawP:rawPoints){p.add(new Point(rawP[0]*factor+100,rawP[1]*factor+100));}
        for(double[]rawN:rawNails){nails.add(new Point(rawN[0]*factor+100,rawN[1]*factor+100));}
        n=nails;
        JFrame frame=new JFrame();
        frame.setSize(700,500);
        frame.setVisible(true);
        frame.getContentPane().add(this);
        d(p,nails);
    }
    public static void main(String[]a) throws InterruptedException{
        new Q();
    }
    void d(List<Point>a,List<Point>nails) throws InterruptedException{
        //add midpoint every iteration until length of 1 is achieved
        //begin algorithm
        //stop points that are within a small amount of a nail
        double distance=20;
        while(distance>1){
            distance=0;
            for (int i=0;i<a.size()-1;i+=2){
                double fir=a.get(i).x;
                double sec=a.get(i).y;
                double c=(fir+a.get(i+1).x)/2;
                double d=(sec+a.get(i+1).y)/2;
                a.add(i+1,new Point(c,d));
                double dist=distBP(new Point(fir,sec),new Point(c,d));
                if(dist>distance){distance=dist;}
            }
        }
        for(Point p:a){a.set(a.indexOf(p), new Point(p.x,p.y));}
        //algorithm starts here:
        setEqual(a);
        repaint();
        invalidate();
        System.out.println(a);
        int count=0;
        while(true){
            count++;
            for(int index=0;index<a.size()-2;index++){
                double x2=(a.get(index).x+a.get(index+2).x)/2;
                double y2=(a.get(index).y+a.get(index+2).y)/2;
                int pointStable=0;
                if(distBP(a.get(index),a.get(index+1))<.5){a.remove(index);}
                for(Point n:nails){
                    if(distBP(n,new Point(x2,y2))<1){pointStable=1;}
                }
                if(pointStable==0){a.set(index+1, new Point(x2,y2));}
            }
            if(count%10==0){
            setEqual(a);
            invalidate();
            repaint();
            Thread.sleep(5);
            }
        }
        //System.out.println(a);
    }
    void setEqual(List<Point>a){
        points = new ArrayList<Point>();
        for(Point p:a){points.add(p);}
    }
    double distBP(Point a,Point b){
        return Math.sqrt(Math.pow(b.x-a.x, 2)+Math.pow(b.y-a.y, 2));
    }
    @Override
    public void paintComponent(Graphics g){
        g.setColor(Color.white);
        g.fillRect(0,0,getWidth(),getHeight());
        g.setColor(Color.black);
        for(Point p:points){
            g.drawRect((int)p.x, (int)p.y, 1, 1);
        }
        for(Point nail:n){
            g.drawOval((int)nail.x-2, (int)nail.y-2, 4, 4);
        }
    }
}

Your username is well-suited to this problem.

Ell has provided an interesting edge case that I didn't think about. I've clarified the spec and added that example. How does your code perform on that example? Since this was clarified after your post, you're not obliged to fix your code, if it doesn't comply with the updated spec, but I thought I'd let you know.

I introduced some changes to fix it, but it revealed a bug in my program (if you try to input it the last example, it only shows one line). I will attempt to fix it.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
The Saltine Challenge
Here is an ASCII saltine cracker:
 _________________
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|_________________|

Here are two crackers stacked:
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     .     .     |
|  .   |  .     .     .  |
|______|     .     .     |
       |  .     .     .  |
       |_________________|

Write the shortest program possible that takes a positive integer and draws a stack of that many ASCII saltine crackers.
Input may come from stdin, command line, or you may simply write a function. The input will always be valid. Output must go to stdout or closest alternative.
Each stacked cracker is always shifted 2 characters down and 7 characters right of the cracker below it. There should be no trailing spaces or extraneous newlines.
The shortest program in bytes wins.
Examples
If the input is 1 the output is
 _________________
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|     .     .     |
|  .     .     .  |
|_________________|

If the input is 2 the output is
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     .     .     |
|  .   |  .     .     .  |
|______|     .     .     |
       |  .     .     .  |
       |_________________|

If the input is 3 the output is
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     . __________|______
|  .   |  .   |  .     .     .  |
|______|     .|     .     .     |
       |  .   |  .     .     .  |
       |______|     .     .     |
              |  .     .     .  |
              |_________________|

And so on.
the real saltine challenge

How does the outline of the cracker below overrides the outline of the one above it?

For 0, should the program cleanly exit with no output? Or do we not have to handle 0?

@proudhaskeller The cracker pattern extends as you would expect from the examples. What about the border is unclear?

@Calvin'sHobbies: I think he's questioning why the top border of the stacked crackers is ___|___ instead of _______. I'm guessing it would look weird if it were the latter

@Claudiu Oh. Yeah, it's not perfect but it looks weirder the other way.

@Calvin'sHobbies In fact, I think that single character is the most interesting part of this challenge. ^^

Passing 0 should segfault.

CJam, 140 125 119 116 bytes
li__7*C+S*a\2*5+*\{5m>S'|6*+_" ."5*5/{'__@\++}:U%3*0@t{S5*U_}%\a+zsB'|tJ/{\(J>@\+a+}/{7m<}%}*{Cm<0{;)_' =}g+}%N*B'_t

Try it online.
A single saltine
The code snippet
S'|6*+_      " Push ' ||||||' twice.                                                      ";
" ."5*5/     " Push [' . . ' '. . .'].                                                    ";
{'__@\++}:U% " Prepend and append an underscore to each string in the previous array.     ";
3*           " Repeat the resulting array thrice.                                         ";
0@t          " Replace its first element with ' ||||||'.                                  ";
{S5*U_}%     " Insert '_     _' after each element of the array.                          ";
\a+          " Append ' ||||||' to the array.                                             ";
z            " Zip; transpose rows with columns.                                          ";
sB'\t        " Flatten the array of strings and replace the 12th element with a '|'.      ";
19/          " Split into chunks of length 19.                                            ";

leaves the following on the stack:
[
  " __________|______ "
  "|  .     .     .  |"
  "|     .     .     |"
  "|  .     .     .  |"
  "|     .     .     |"
  "|  .     .     .  |"
  "|_________________|"
]

Stacked saltines
Assume the saltine from above is saved in Z.
li               " I := int(input())                                                      ";
__7*C+S*a\2*5+*  " R:= [(I * 7 + 12) * ' '] * (I * 2 + 5)                                 ";
\{               " Repeat I times:                                                        ";
  5m>            "   R := R[-5:] + R[:-5]                                                 ";
  Z              "   Push a single saltine, as an array of lines.                         ";
  {              "   For each line L of the saltine:                                      ";
    \(J>@\+a+    "     R := R[1:] + [R[0][19:] +     L]                                   ";
  }/             "                                                                        ";
  {7m<}%         "   R := [ L[7:] + L[:7] : L in R ]                                      ";
}*               "                                                                        ";
{                " R := [                                                                 ";
  Cm<            "   (L[12:] + L[:12])                                                    ";
  0{;)_' =}g+    "                    .rstrip()                                           ";
}%               " : L in R ]                                                             ";
N*               " R := '\n'.join(R)                                                      ";
B'_t             " R[11] := '|'                                                           ";

JavaScript (E6) 249  259 289 304 345
Not so confident about the string compression.
Found a good compression for the strings. The simple 1 cracker case seems difficult to manage. There may be a better way...
F=n=>{
  for(B=",|4.,|1.2,|1.4.4.1|,|5,|4.4.4|, 9|5, 87 ,|87|".replace(/\d/g,c=>' _'[c>4|0][R='repeat'](-~c)).split(','),
  O=(c,b=0,a=0)=>console.log(' '[R](y)+B[a]+B[b][R](x)+B[c]),
  r=x=y=0,
  O(7);
  O(3,2),
  !(z=++r>2)|x;)
    x+=(v=r<n)-z,O(v+5,1,z*4),y+=z*7;
  O(8)
}

Ungolfed more or less
That is the basic code, before I started golfing. It's not exactly the same and works only for n > 2
F=n=>{
  O=t=>console.log(t)

  r=0
  x=0
  y=0

  O(' _________________')
  O(' '.repeat(y)+'|  .   '.repeat(x)+'|  .     .     .  |')

  while (++r<n)
  {
    x++;
    if (r>2)
    {
       x--;
       O(' '.repeat(y)+'|______'+'|     .'.repeat(x)+' __________|______')
       y+=7;
       O(' '.repeat(y)+'|  .   '.repeat(x)+'|     .     .     |')
    }
    else
    {
       O(' '.repeat(y)+'|     .'.repeat(x)+' __________|______')
       O(' '.repeat(y)+'|  .   '.repeat(x)+'|  .     .     .  |')
    }

  }
  while(x--)
  {
     O(' '.repeat(y)+'|______'+'|     .'.repeat(x)+'|  .     .     .  |')
     y+=7;
     O(' '.repeat(y)+'|  .   '.repeat(x)+'|     .     .     |')
  }

  O(' '.repeat(y)+'|_________________|')
}

Test In FireFox/FireBug console
F(4)

Output
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     . __________|______
|  .   |  .   |  .     .     .  |
|______|     .|     . __________|______
       |  .   |  .   |  .     .     .  |
       |______|     .|     .     .     |
              |  .   |  .     .     .  |
              |______|     .     .     |
                     |  .     .     .  |
                     |_________________|

Python, 252 241 characters
s="eJxTiIeDGgiloBBRo6CgpwACcLIGJKaAKlxDmbp4dFADAL+oIFI=".decode('base64').decode('zip').split('X')
N=input()
R=range
G=map(list,[' '*(7*N+12)]*(2*N+5))
for n in R(N):
 for y in R(7):G[2*n+y][7*n:]=s[y]
G[0][11]='_'
for g in G:print''.join(g)

Thanks to FryAmTheEggman and Vincent for snipping off 11 characters.
A preponderance of crackers:
$ echo 17 | python saltines.py
 _________________
|  .     .     .  |
|     . __________|______
|  .   |  .     .     .  |
|     .|     . __________|______
|  .   |  .   |  .     .     .  |
|______|     .|     . __________|______
       |  .   |  .   |  .     .     .  |
       |______|     .|     . __________|______
              |  .   |  .   |  .     .     .  |
              |______|     .|     . __________|______
                     |  .   |  .   |  .     .     .  |
                     |______|     .|     . __________|______
                            |  .   |  .   |  .     .     .  |
                            |______|     .|     . __________|______
                                   |  .   |  .   |  .     .     .  |
                                   |______|     .|     . __________|______
                                          |  .   |  .   |  .     .     .  |
                                          |______|     .|     . __________|______
                                                 |  .   |  .   |  .     .     .  |
                                                 |______|     .|     . __________|______
                                                        |  .   |  .   |  .     .     .  |
                                                        |______|     .|     . __________|______
                                                               |  .   |  .   |  .     .     .  |
                                                               |______|     .|     . __________|______
                                                                      |  .   |  .   |  .     .     .  |
                                                                      |______|     .|     . __________|______
                                                                             |  .   |  .   |  .     .     .  |
                                                                             |______|     .|     . __________|______
                                                                                |  .   |  .   |  .     .     .  |
                                                                                |______|     .|     . __________|______
                                                                                |  .   |  .   |  .     .     .  |
                                                                                |______|     .|     . __________|______
                                                                                |  .   |  .   |  .     .     .  |
                                                                                |______|     .|     .     .     |
                                                                                |  .   |  .     .     .  |
                                                                                |______|     .     .     |
                                                                                |  .     .     .  |
                                                                                |_________________|

This code seems really inefficient, but other answers will tell. It just copies and pastes the saltine cracker into an array at the right spot, accounts for the bottom-most cracker being 1-character off, then prints it all.
I can get it down to 230 characters if I use an external file (202 code + 38 file size + 1 file name).

Please show every output for n=1 upto 2^10 so we can be sure that your program really does the right thing.

list(' '*(7*N+12)) could be [' ']*(7*N+12).

@flawr: Sir, is that to say - are you say - are you, ah, alluding to - insinuating or perhaps just suggesting, that I was being silly?

@Claudiu I can assure that I would not even dare to think of insinuating you of an act that would even only have an impalable touch of sillynes. =P

I'm pretty sure you can replace G[2*n+y][7*n:7*n+19] with G[2*n+y][7*n:]

And G=[list(' '*(7*N+12))for _ in R(2*N+5)] with G=map(list,[' '*(7*N+12)]*(2*N+5))

Perl 189
Stealing some string compression ideas from choroba, I got it down to:
echo 4 | perl -E 's/\d/($&<8?$":_)x$&/ge for@l=("|2.5.5.2|"," 98","|5.5.5|","|98|",7)[102020344=~/./g];map{say for@l[0,1];$l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;substr$l[0],-7,1,"|"}2..<>;say for@l[0..6]'

For easier viewing in your browser:
s/\d/($&<8?$":_)x$&/ge for@l=
("|2.5.5.2|"," 98","|5.5.5|","|98|",7)[102020344=~/./g];map{
    say for@l[0,1];
    $l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;
    substr$l[0],-7,1,"|"
}2..<>;say for@l[0..6]

For context, my best before that:
Perl 207
$u='_'x11;s/:/ .  /g,s/.(.)/$&$1/g,$_.=$/for@l=("|:: . |"," $u","|  :: |","|$u|",$"x5)[102020344=~/./g];map{print@l[0,1];$l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;substr$l[0],-8,1,'|'}2..pop;print@l[0..6]

Adding newlines and indentation for ease of reading in your browser:
$u="_"x11;
s/:/ .  /g,s/.(.)/$&$1/g,$_.=$/for@l=
("|:: . |"," $u","|  :: |","|$u|",$"x5)[102020344=~/./g];
map{
    print@l[0,1];
    $l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;
    substr$l[0],-8,1,"|"
}2..pop;
print@l[0..6]

You can replace "pop" with "<>" to take the count from STDIN instead of as a command-line parameter and get to 206 bytes.  Going to STDERR would drop it to 204 bytes.
If I could enable the 'say' feature without a byte penalty, then I could get to 202.
$u="_"x11;s/:/ .  /g,s/.(.)/$&$1/g for@l=("|:: . |"," $u","|  :: |","|$u|",$"x5)[102020344=~/./g];map{say for@l[0,1];$l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;substr$l[0],-7,1,"|"}2..<>;say for@l[0..6]

invoked as:
echo 4 | perl -E '$u="_"x11;s/:/ .  /g,s/.(.)/$&$1/g for@l=("|:: . |"," $u","|  :: |","|$u|",$"x5)[102020344=~/./g];map{say for@l[0,1];$l[$_]=substr($l[$_+2],0,7).$l[$_]for 0..6;substr$l[0],-7,1,"|"}2..<>;say for@l[0..6]'

You are allowed to enable say without a penalty because it is the same as running on the command line with -E instead of -e. perl -E'' doesn't count toward your total characters.

Your output is incorrect. Check the _|_.

@choroba, thanks! I forgot to put that substr back in after trying to replace it with y/|/_/ (but always ending up with longer code).  From 168 to 189.

Perl 201
(remove newlines except the first one to get the #)
$_=" 46|6
15.5.5|15.5.5|198|";
s/1/|  .5.5.  ||/g;
s/\d/(5^$&?_:$")x$&/ge;
@o=@l=/.{18}.?/g;
map{
$s=$_*7;
substr$o[$_-5],$s,12,$l[$_]for 0..4;
push@o,($"x$s).$l[$_]for 5,6
}1..-1+pop;
$o[$,=$/]=~y/|/_/;
print@o

say + <> = 198.

"There should be no trailing spaces"

@Tye: OK, back to 202 :-(

Haskell, 215 bytes
This one builds up the cracker stack inductively, pulling cracker parts and spacing out of a couple of cyclic lists:
(b:u:i)=" _|"
(%)=replicate
z=5%b++'.':z
m!n=i++map(z!!)[m..n]
s=7%b:s
d=3!19++i
e=0!16++i
y=i++6%u
g 1=[e,d,e,d,i++17%u++i]
g k=zipWith(++)(0!5:3!8:0!5:3!8:y:s)$(b:10%u++y):d:g(k-1)
f k=mapM putStrLn$(b:17%u):d:g k

The control flow is pretty straightforward; most of the trickery is in reusing as much of the cracker parts as possible.
Ungolfed:
top     = " _________________"
top'    = " __________|______"
dots3   = "|  .     .     .  |"
dots2   = "|     .     .     |"
bot     = "|_________________|"

halfR   = "|     ."
halfL   = "|  .   "
halfBot = "|______"

spacer  = "       "
spaces = repeat spacer

saltine = above ++ [dots2, dots3, dots2, dots3, bot]
above   = [top, dots3]
left    = [halfR, halfL, halfR, halfL, halfBot] ++ spaces

another (oldTop:oldCracker) = above ++ zipWith (++) left (top' : oldCracker)

crackers 1 = saltine
crackers k = another $ crackers (k - 1)

test = putStr . unlines . crackers

Python, 299
I thought I was being clever but the solution turned out to be overly complicated and longer than any straight forward approach, yet I couldn't resist to post it. The program explicitly calculates which character has to be plotted at the different positions of the output string, without looping over the individual crackers.
N=input()
m,n,c,r=12+7*N,5+2*N,3.5,range
print''.join(i>m-2and'\n'or(i%7<(i/c<j<7+i/c)*(i<N*7)or(i+4)%7<(i/c<j+4<2+4*(i>m-3)+i/c)*(i>16))and'|'or j%2<(j*c<i<17+j*c)*(j<n-5)+(j*c<i+22<8+10*(j>n-3)+j*c)*(j>5)and'_'or(i-j*3-min(i/7,~-j/2,N-1)+1)%6<(-3<-~i/7-j/2<3)and'.'or' 'for j in r(n)for i in r(m))

And the last line  expanded to see what's going on:
print ''.join(
              '\n' if i>m-2 else
              '|' if i%7<(i/c<j<7+i/c)*(i<N*7) or (i+4)%7<(i/c<j+4<2+4*(i>m-3)+i/c)*(i>16) else
              '_' if j%2<(j*c<i<17+j*c)*(j<n-5)+(j*c<i+22<8+10*(j>n-3)+j*c)*(j>5) else
              '.' if (i-j*3-min(i/7,~-j/2,N-1)+1)%6<(-3<-~i/7-j/2<3) else
              ' '
              for j in r(n)
              for i in r(m)
             )

C,284
For the function f and the #defines, excluding unnecessary whitespace and main. In accordance with edc65's comment, I have included a 128-bit integer type (which I was going to do anyway) but I miscalculated again and I can only do 29 crackers before the tops start going missing.
Complete function and test program below. Will comment it later.
#define C b,b,c,b,b
#define S s[i/v*7-i%v
f(n){
  __int128 a=4095,b=a+2,c=6281,d=4641,w=998,v=19,s[998]={a,C,d,C,d,C,a},i=v;
  for(;i<n*v;i++)S+18]|=S+11]*16&-1<<(12+i/v*2-i%v/18)*(i%v>7);
  for(i=(5+n*2)*w;i--;i%w||puts(""))i%w>i/w/2*7-21+i/w%2*6&&s[i%w]&&putchar(" _.|"[(s[i%w]>>i/w*2)&3]);
}

main(){
  int m;
  scanf("%d",&m);f(m);
}

There are only four different characters in the output. These are decoded from binary numbers 0-3 by " _.|". The array s[] contains an integer for each column of the output, 2 bits per symbol, which is intitialised to contain the rightmost cracker.
The first for loop copies the previous cracker, leftshifts it to move it up, deletes the bottom right corner using &  and ORs it with the previous cracker, 7 steps to the left.
The second for loop decodes the 2-bit representation of each character into the actual character and prints the character. There's a lot of code here just to suppress unnecesary whitespace in the output. I'm disappointed that my score went up instead of down from my previous revision.
Output
That's 29 crackers. I replaced the space with a - for a different look, and to show that no trailing spaces or extraneous newlines in the output.
-_________________
|--.-----.-----.--|
|-----.-__________|______
|--.---|--.-----.-----.--|
|-----.|-----.-__________|______
|--.---|--.---|--.-----.-----.--|
|______|-----.|-----.-__________|______
-------|--.---|--.---|--.-----.-----.--|
-------|______|-----.|-----.-__________|______
--------------|--.---|--.---|--.-----.-----.--|
--------------|______|-----.|-----.-__________|______
---------------------|--.---|--.---|--.-----.-----.--|
---------------------|______|-----.|-----.-__________|______
----------------------------|--.---|--.---|--.-----.-----.--|
----------------------------|______|-----.|-----.-__________|______
-----------------------------------|--.---|--.---|--.-----.-----.--|
-----------------------------------|______|-----.|-----.-__________|______
------------------------------------------|--.---|--.---|--.-----.-----.--|
------------------------------------------|______|-----.|-----.-__________|______
-------------------------------------------------|--.---|--.---|--.-----.-----.--|
-------------------------------------------------|______|-----.|-----.-__________|______
--------------------------------------------------------|--.---|--.---|--.-----.-----.--|
--------------------------------------------------------|______|-----.|-----.-__________|______
---------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
---------------------------------------------------------------|______|-----.|-----.-__________|______
----------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
----------------------------------------------------------------------|______|-----.|-----.-__________|______
-----------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-----------------------------------------------------------------------------|______|-----.|-----.-__________|______
------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
-------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
--------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
--------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
---------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
---------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
----------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
----------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
-----------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-----------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
-------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
--------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
--------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
---------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
---------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
----------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
----------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-__________|______
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.---|--.-----.-----.--|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.|-----.-----.-----|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--.---|--.-----.-----.--|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|______|-----.-----.-----|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--.-----.-----.--|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|_________________|

There was no max value in the question, just "a positive integer". So 1 to 5 is your idea of any positive integer?

@edc65 For a few more bytes you can have a 128-bit integer type instead of 32 bits. That will take it up to 56 crackers, which should be enough (that's over 20kb of output). I admit I miscalculated the number of crackers I could get with a 32-bit integer when I started, I thought it was at least ten. But yes, all programs will have some kind of upper limit on the number of crackers they can produce and it is up to the OP to decide what that is. It should be specified in the question. As it is I will accept the OP's ruling on the validity of my answer (which isn't finished.)

JavaScript (ES6) HTML5 - 233 236 bytes
Probably not a valid answer, but I just couldn't resist posting, sorry :-P
F=n=>{d="______";b="\n|  .     .     .  |";a=b+"\n|     .     .     |";for(i=0;i<n;)document.body.innerHTML+="<pre style='background:#fff;position:fixed;top:"+i*28+"px;left:"+i*56+"px'> ____"+d+'|_'[+!i++]+d+a+a+b+"\n|"+d+d+"_____|"}

Test in Firefox with F(1), F(2), F(3), etc.
Example: http://jsfiddle.net/Lvmg9fe8/7/

I don't know JavaScript, but this Fiddle doesn't appear to do anything (whereas I've been able to run other Fiddles no problem.) I have Google Chrome and Internet Explorer.

@steveverrill it works only in Firefox, like almost everything that's sold as JavaScript here. Chrome and IE don't support EcmaScript 6.

It works (in Firefox), though it's not quite what I'm looking for ;)

I can't seem to get this to work either... I'm receiving an "undefined" response whenever I enter F(1) or any other number, after having entered this code in JS console in Firefox...

Canvas, 54 bytes
Ｈ┐“)4╪xω╷┘IＱ+aｚQ┴¾４＊↔⌐∔v│↶++z2；ｅ＼１ｐ9H+m}`1Ｌ²‟19┤ｎ；８３╋╋

Try it here!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Manhattan Police
Introduction
You are the police chief of the NYPD and you have been tasked to position police officers so that all of the streets are patrolled. Your squad is short-staffed, however, meaning that you need to position as little officers as possible.
Challenge
Given a map of blocks, you must return the smallest number of officers needed to secure the streets.
Rules
There are three types of police officers: an L cop, a T cop and a cross cop. The T cop can see in three directions only. The L cop can see down two streets which are perpendicular. The cross cop can see down all four streets.
The map will be supplied via argv or STDIN as space separated numbers. The numbers represent the number of blocks in each column. For example:
Input 2 1 represents the following map:

Input 3 1 2 4 represents the following map:

A police officer may only be placed at an intersection and its view may only be along the side of a block (cops may not look into uninhabited areas).
A cop can only see for one block and cannot look along a street where another police officer is looking meaning that sight lines must not overlap.
Examples
Input: 2 1

Output: 4

Input: 2 2
Output: 4

Input: 3 1 4 1 5 9
Output: 22
Winning
The shortest code wins.

How far can a cop see? I.e., if I put a cop on an intersection, can he see all the way down both the streets?

What stops me from only using cross cops? It doesn't seem to matter whether a cop looks in uninhabitated areas or scans the same area as another cop as long as at least a T or L cop would be necessary there anyway.

If you add the condition that sight lines can not overlap and cops can't look in uninhabited areas, this would be a bit more challenging. (doesn't help the story's plausibility, but...)

I am picturing Chief Wiggum, Lou and Eddie.

Clearly people get overly nervous if they see too many cops next to each other.

If I understand the task correctly, this is very close to minimum vertex cover in bipartite graph problem. Close because cops guarding only one street or two opposite streets are not allowed (not sure if intentional or by omission) - this may or may not make it harder. See http://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29
Of the problem is limited to subset of graphs (planar, degree <= 4), but still I don't know how a heuristic based on the numbers on the input would generate a correct answer.

CJam, 68 61 84 ... 59 49 48 79 bytes
l~]__,+:+M@{:Ze<:X2/)_2*X-@+@@-\Z}*;[YY]/_,(\R*_,,:)W%{2\2*1a*+2+/_S*\,(@+\}/;+

Takes input in the same format as in question.
UPDATE : Fixed the algorithm for test cases similar to what pointed out by @nutki. Although it made the code almost double in size, will try to golf it now that its fixed.
How it works (Slightly incomplete, will add the 2 1 2 parity explanation later)
As soon as I saw this question, I knew that there would be a mathematical formula to get the answer. After trying a couple of combinations, I figured that the formula is 2 * Number of blocks - Number of shared streets
Lets check is for 2 1 case:
2 * 3 - 2 = 4

Correct.
Lets check for 3 1 2 4 case:
2 * 10 - 10

Correct again. Yipee, so the code is
l~]:L:+2*L:(:+L(+-[{_@e<}*]:+-

Now lets try this on some more examples:
3 3

Output:
2 * 6 - 7 = 5

But wait, the actual answer is 6
Lets try another:
5 5

2 * 10 - 13 = 7 // Answer is 9 instead.

You see the pattern ?
For every N N block pair, where N is positive integer greater than 2, I require float((N+1)/2)-1 extra cop apart from the formula above. Lets verify it again:
5 5 3

2 * 13 - 18 = 8 // Answer is 11

In the above example, we have 1 5 5 pair and 1 3 3 pair (from the 5 3 blocks)
Lets try another example
5 5 4 4

2 * 18 - 27 = 9 // Answer is actually 14

You must be thinking that there are only 5 5, 3 3 and 3 3 pairs (from blocks 5 5, 5 4 and 4 4 resp.) , thus only 4 extra cops required, but there is one more pair.
From the blocks 4 4, we used up only 3 3 so we have 1 1 free, this makes up another 3 3 block pair which can be visualized using the image below:

The red outlined are the usual pairs, the blue outlined is the perpendicular pair which I am talking about above.
It's kind of hard to explain as while the red outlined are just sharing 1 side of the pair, the blue one is sharing 1 side + 1 block too. But this logic works for all block combinations.
The code now is simply calculating that.
l~]__                        "Read the input numbers, convert to array and make two copies";
     ,+                      "Get the number of columns and add that to the block array";
       :+                    "Sum the array elements to get number of blocks + columns";
         M@                  "Push empty array to stack and rotate input array to top";
{                         }* "Run this block for each pair in the block array";
 :Ze<:X                      "Store the later block size in Z, and minimum of two in X";
       @\-                   "Rotate swap and subtract shared sides from total sum";
          X)Y/(:T+           "Increment halve and decrement. Store in T and add to sum";
                  XTY*-      "Find unused blocks from this pair for perpendicular pairs";
                       @+    "Add unused blocks to the array M";
                         Z   "Push Z to stack to be used in next iteration";
           ;[YY]             "Pop the last pushed Z and push array [2 2] to stack";
                /,(+         "Check how many perpendicular pairs exist, add to total sum";

Note that 2 * Number of blocks - Number of shared sides can also be written as
Number of blocks + Number of columns - Number of shared sides between adjacant columns
Try it online here

This produces the correct output for all of the tests I've tried so far.

Why's input 2 2 2 giving the solution 5? Could you please explain how a 5 set combination is possible?

Check 4 4 4 4 as well. The routine gives 11, but I can't see any way of doing it with fewer than 12.

I know I'm a bit late, but how does this work?

This gives 18 for 2 2 1 1 2 2 1 2 2 1 1 2 2 my counter example for @FireFly solution. However I cannot see anything better than 19. Can you show the placement for this test case?

@nutki Now it should be fixed.

How about this 4 4 3 3 4 4 3 4 4 3 3 4 4 is 33 and 4 4 3 3 4 4 2 4 4 3 3 4 4 (one street less) is 34 (more)? I don't think both can be correct.

If you have a proof, then please feel free to comment, otherwise, there is no point in questioning the outputs.