XArt

Phase 1 – Pixel analysis and selection

Create a Python script that loads an image, counts pixel frequencies, and selects the top X most frequent colors based on command-line input.

  • Load image from command line
  • Count frequency of each pixel color
  • Select top X colors
  • Display selected colors or store for later use

Functional result: Script identifies and outputs the X most frequent pixel colors from the given image.

Phase 2 – Random artwork generation

Use the selected top X colors to generate a new image with random lines, shapes, and zones.

  • Create a blank canvas
  • Draw random lines, shapes, and areas using only the selected colors
  • Save the generated image
  • Ensure visual randomness while restricted to top X colors

Functional result: Script produces a new random artwork image using only the top X colors from the original photo.