Keeping the clutter out: how duplicates get caught
If a computer makes 30 pictures a night, a few of them will be too alike. Two kittens on two blankets can come out looking like the same photograph. A gallery that shows the same idea twice in a row feels broken, so a script called the duplicate filter runs after every batch. It catches two different kinds of "too similar."
Kind 1: the same idea made twice
Sometimes the recipe from Part 2 produces two pictures of the same idea, like a kitten on a blanket by a window. When that happens the script keeps the better one.
"Better" is a simple, honest test: which picture has more fine detail. The script makes a small grayscale copy, 512 pixels wide at most, runs an edge-finding filter over it, and measures how much the edges vary. A sharp, well-exposed picture has lots of crisp edges. A blurry or washed-out one does not. It is not an art critic, but it is a decent stand-in for "in focus and well lit."
Kind 2: different ideas that look the same
Two different recipes can still land on nearly the same composition, like a small animal centered in a warm window. To catch these the script gives every picture a fingerprint:
- Shrink the picture to a tiny 17 by 16 grayscale image.
- For each pixel, write down one bit: is it brighter than the pixel to its left?
- That gives 256 bits, a pattern of light and dark that survives different colors, sizes and small changes.
Two pictures with the same layout end up with almost the same 256 bits. The script counts how many bits differ. If it is 40 or fewer (out of 256), the pictures are called near-duplicates and only one is kept. This kind of fingerprint is called a difference hash, and it is cheap enough to compare every new picture against everything already on the site.
My own lists always win
Two plain text files give me the final say:
- keep.txt: pictures that must always stay. They win any tie.
- reject.txt: pictures I never want to see on the site. The automatic filter never touches this list.
The filter writes its own decisions to a separate file, so my choices and the machine's choices never get mixed up.
Looking at a whole batch
After a run, one command makes contact sheets: pages with a grid of the new pictures so I can scan a whole batch in under a minute. If I spot something wrong, such as an extra paw, a strange face or a word that is not a word, another command takes it off the site and republishes.
I will be straight about the limits. The filter judges sharpness and layout. It does not understand cuteness, and it cannot see a mistake like an extra leg. That is why the recipe avoids the things AI does worst, and why I keep the review sheets handy.
Next: from my PC to your phone.