Cursor Project Practice-01: Screenshot to GIF Conversion for Specified Screen Areas

Project Description

This is a practice project using cursor, implemented in Python, designed to convert screen captures into GIF images for result demonstration or examples.

Result Demonstration

screentogif_20250706_171615.gif

Prerequisites

  • Cursor

    • Version: 1.2.1
    • Cursor rules: Cursor Rules
    • Agent: claude-4-sonnet-thinking
  • Overall Workflow

    • Set cursor rules → Describe requirements → Cursor coding → Git version control → Debugging output

Project Steps

  1. Organize requirements and have cursor generate project structure. Requirements as follows:
## Develop a Python program to convert screen captures into GIF images
1. The program should capture specified screen areas (selected via mouse drag) and save images in webp format
2. Compress images and generate GIF files
3. Include an interface for setting compression ratio, frame rate, and save path

## Requirements
1. Only essential features, no additional functionality
2. Note screen scaling ratio as I'm using a Mac computer
  1. Establish project structure by inputting requirements:

    Analyze the requirement.md documents and start project writing

    image.png

  2. Generate project documentation

image.png

  1. Set up virtual environment and install dependencies

image.png

  1. Complete basic framework and interface functionality

image.png

  1. Region selection feature incomplete. Continue implementation

image.png

  1. Feature completed

image.png

  1. Generated images too large. Continue optimization

image.png

Issue Log

  • Issue 1

    • Problem: Region selection was command-line based rather than graphical interface.
    • Solution: Directly instructed cursor to modify, specifying need for GUI
  • Issue 2

    • Problem: Requirements description wasn't precise enough, leading to feature creep
    • Solution: Added appropriate context and more accurate feature descriptions
  • Issue 3

    • Problem: Significant difference between claude-4-sonnet and claude-4-sonnet-thinking. Former took an hour without resolution, latter solved in 3 requests within 5 minutes.
    • Solution: Prefer thinking version for complex problems or solution analysis

Usage Insights

  1. Added date acquisition in rules to prevent model from using only its internal date reference.
  2. For Python programs, added virtual environment creation in rules to prevent multi-project environment conflicts