Back to Blog
Generative AI

Transform Unfinished Paintings into Masterpieces with Grokking Art AI Tool

Claude Directory December 29, 2025
1 views

Ever abandoned a half-done artwork? Grokking Art uses Grok-2 to seamlessly complete your sketches and paintings. Upload, mask, and let AI finish in any artist's style!

Ever Started a Painting But Hit a Creative Wall?

Imagine this: You're in the flow, brush in hand (or stylus on tablet), laying down vibrant strokes on a canvas. The composition is taking shape, colors popping, but then... you stall. The unfinished section stares back at you, a blank void mocking your inspiration. Sound familiar? What if an AI could swoop in, understand your vision, and complete the artwork flawlessly—in the style of Van Gogh, Picasso, or even your own twist?

That's exactly what Grokking Art, a clever project by indie hacker Pieter Levels (@levelsio), brings to the table. Launched recently, this web app lets anyone upload an incomplete painting, and Grok-2 from xAI takes over to inpaint the missing parts. No more unfinished masterpieces gathering digital dust!

How Does Grokking Art Actually Work?

Let's break it down step by step. The magic starts simple:

  1. Upload Your Artwork: Drag and drop your half-finished image—could be a digital sketch, oil painting photo, or anything in between.

  2. Smart Masking: The app uses HTML Canvas wizardry to scan the image. It detects 'unfinished' areas, typically white or blank pixels, and automatically generates a precise mask over them. No manual masking hassle!

  3. AI Inpainting Power: This masked image, along with your custom prompt, gets sent to the xAI API. Grok-2, xAI's image generation model, excels at inpainting—filling in masked regions while blending seamlessly with the existing art.

  4. Style It Your Way: Tell it to finish "in the style of Vincent van Gogh" or "as a cyberpunk cityscape." The result? A coherent, professional-looking completion in seconds.

Pieter shared the full source code on GitHub: levelsio/grokking-art. Fork it, tweak it, or deploy your own version—it's open for tinkerers!

A Real-World Example That'll Blow Your Mind

Take this user story from Pieter's tweet (check it out here): Someone uploaded a bizarre, half-sketched portrait—think melting faces and swirling patterns, but only halfway done. They prompted: "Finish this painting in the style of Vincent van Gogh."

Boom! Grok-2 transformed it into a swirling, starry-night-esque vortex of emotion. The unfinished white blobs became textured brushstrokes, vibrant yellows and blues exploding outward. It didn't just fill space; it elevated the original sketch into something gallery-worthy.

Here's a pseudo-code snippet of the core logic (inspired by the GitHub repo):

// Detect white pixels for masking
const canvas = document.getElementById('uploadCanvas');
const ctx = canvas.getContext('2d');
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const maskData = new Uint8ClampedArray(imageData.data.length);

for (let i = 0; i < imageData.data.length; i += 4) {
  const r = imageData.data[i];
  const g = imageData.data[i + 1];
  const b = imageData.data[i + 2];
  if (r > 240 && g > 240 && b > 240) { // Near-white pixels
    maskData[i] = 255; // Opaque mask
  }
}

// Send to xAI API
const prompt = `Finish this painting in the style of ${artistStyle}.`;
const response = await fetch('https://api.x.ai/v1/images/generations', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${API_KEY}` },
  body: JSON.stringify({
    prompt,
    image: base64OriginalImage,
    mask: base64MaskImage,
    model: 'grok-2',
    n: 1,
    size: '1024x1024'
  })
});

This is the beauty of client-side processing: lightweight, fast, and privacy-friendly.

Why Grok-2 Shines for Inpainting (And Others Don't Always)

Not all AI models handle inpainting equally. Stable Diffusion plugins exist, but Grok-2's edge comes from its massive training on diverse art data, leading to more creative, context-aware fills. It understands artistic principles—composition, lighting, perspective—without hallucinating wildly outside your mask.

Compared to Midjourney or DALL-E:

  • Pros of Grokking Art: Precise control via masks, cheap API calls (~$0.10 per image), open-source simplicity.
  • Cons: Still early; might need prompt tuning for photorealism.

Pro tip: Experiment with prompts like:

  • "Complete the landscape with dramatic sunset lighting, oil on canvas texture."
  • "Extend the portrait's expression into a surreal dreamscape à la Salvador Dalí."

Practical Applications: Beyond Hobbyists

Artists aren't the only winners here. Think bigger:

  • Game Devs: Prototype character designs or environments quickly.
  • Marketing Teams: Mock up ad visuals from rough storyboards.
  • Educators: Teach art history by 'completing' student sketches in masters' styles.
  • Therapists: Use for art therapy, helping clients finish emotional pieces.

Real-world win: A designer could upload a logo sketch, mask the empty tagline area, and get elegant typography suggestions.

Build Your Own: Dive into the GitHub Repo

Want to hack on it? The grokking-art repo is a goldmine:

  • Tech Stack: Vanilla JS/HTML for frontend, xAI API backend.
  • Customization Ideas:
    • Add batch processing for multiple images.
    • Integrate style transfer models.
    • Mobile app via Progressive Web App.

Get an xAI API key (sign up at console.x.ai), swap in your key, and host on Vercel/Netlify for free. Cost scales with usage—perfect for side projects.

Potential Pitfalls and Pro Tips

  • Mask Accuracy: Ensure blanks are truly white; tweak the threshold in code.
  • Prompt Precision: Start descriptive: artist + medium + mood.
  • Resolution: Stick to 1024x1024 for best results.
  • Ethics: Credit originals if sharing; AI art debates rage on.

Pieter's tool democratizes completion, sparking joy for creators worldwide. It's a reminder: AI isn't replacing artists—it's the ultimate collaborator.

What's Next for AI Art Completion?

Grokking Art proves small tools pack big punches. With models like Grok-2 evolving, expect:

  • Real-time collaboration (AI suggests as you paint).
  • Multi-modal inputs (voice-describe the finish).
  • AR previews on physical canvases.

Tried it? Upload your stalled sketch to grokking.art today. You might just finish that magnum opus.

(Word count: ~1050)


<div style="text-align: center; margin-top: 2rem;"> <a href="https://www.deeplearning.ai/the-batch/unfinished-artwork-no-more/" target="_blank" rel="noopener noreferrer" class="view-full-resource-btn" style="display: inline-block; background-color: #f97316; color: white; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: background-color 0.2s;">View Full Resource</a> </div>
GitHub Project

Comments

More Blog

View all
Data & Analysis

Model Predictive Control Fundamentals: Concepts, Math, and Python Implementation

Discover the essentials of Model Predictive Control (MPC), from its core principles and mathematical foundations to practical Python implementations for dynamic systems control.

C
Claude Directory
2
Data & Analysis

Overcoming GPU Limitations: Implementing FP8 Emulation in Software for Legacy Hardware

Discover how to run FP8-optimized AI models on older GPUs without native hardware support using a clever software emulation layer. Boost inference speeds dramatically on Turing-era cards like the RTX 2080.

C
Claude Directory
4
Data & Analysis

Hands-On Guide to Hugging Face Transformers: Supercharge Your NLP Projects with AI

Discover how Hugging Face's Transformers library makes advanced NLP accessible. From quick pipelines for sentiment analysis to fine-tuning models, build powerful AI apps effortlessly.

C
Claude Directory
1
Data & Analysis

Demystifying Matrix-Matrix Multiplication: Essential Concepts and Practical Insights

Dive deep into matrix-matrix multiplication, from fundamental row-column rules to efficient algorithms like Strassen's, with Python examples and real-world applications in data science.

C
Claude Directory
2
Data & Analysis

Demystifying Matrix Transpose: Your Ultimate Guide to A^T and Its Superpowers in Data Science

Dive into the exciting world of matrix transpose! Discover what A^T really means, master its properties, code it up in Python, and explore real-world applications that transform your data game.

C
Claude Directory
Data & Analysis

Empowering AI Agents to Build Other Agents: A Practical Guide to Meta-Agent Development

Discover how large language models like Claude can generate code for autonomous AI agents, streamlining development and enabling rapid iteration on complex tasks. This approach turns manual coding into an automated, scalable process.

C
Claude Directory