Pixel Pick Skill
Interactive tool to click on an image and get exact pixel coordinates.
Usage
/pixel-pick /path/to/image.png
/pixel-pick /path/to/image.png --output coords.json
Process
Create interactive picker script
#!/usr/bin/env python3
"""Click on image to get coordinates."""
import sys
from PyQt6.QtWidgets import QApplication, QLabel, QMainWindow
from PyQt6.QtGui import QPixmap, QMouseEvent
from PyQt6.QtCore import Qt
class PixelPicker(QMainWindow):
def __init__(self, image_path):
super().__init__()
self.setWindowTitle(f"Pixel Picker - {image_path}")
self.coords = []
self.label = QLabel()
self.pixmap = QPixmap(image_path)
self.label.setPixmap(self.pixmap)
self.setCentralWidget(self.label)
self.resize(self.pixmap.size())
def mousePressEvent(self, event: QMouseEvent):
x, y = event.pos().x(), event.pos().y()
print(f"Clicked: ({x}, {y})")
self.coords.append((x, y))
if __name__ == '__main__':
app = QApplication(sys.argv)
picker = PixelPicker(sys.argv[1])
picker.show()
app.exec()
Run the picker
python3 pixel_pick.py /path/to/image.png
Click on elements to get coordinates
- Each click prints (x, y) to terminal
- Coordinates are relative to image top-left
Output Format
Clicked: (384, 208)
Clicked: (418, 208)
Clicked: (452, 208)
Generating Layout Code
After collecting coordinates, generate code:
# Convert clicks to _box() calls
coords = [(384, 208), (418, 208), (452, 208)]
for i, (x, y) in enumerate(coords):
print(f'"BUTTON_{i}": _box({x}, {y}, 28, 20),')
Tips
- Click top-left corner of each button
- Note the pattern/spacing for similar buttons
- Use grid overlay (/align-debug) first for reference
1---2name: pixel-pick3description: Interactive coordinate picker - click on an image to get exact pixel coordinates. Useful for mapping UI element positions. Invoke with /pixel-pick <image-path>.4---56# Pixel Pick Skill78Interactive tool to click on an image and get exact pixel coordinates.910## Usage1112```13/pixel-pick /path/to/image.png14/pixel-pick /path/to/image.png --output coords.json15```1617## Process18191. **Create interactive picker script**20 ```python21 #!/usr/bin/env python322 """Click on image to get coordinates."""23 import sys24 from PyQt6.QtWidgets import QApplication, QLabel, QMainWindow25 from PyQt6.QtGui import QPixmap, QMouseEvent26 from PyQt6.QtCore import Qt2728 class PixelPicker(QMainWindow):29 def __init__(self, image_path):30 super().__init__()31 self.setWindowTitle(f"Pixel Picker - {image_path}")32 self.coords = []3334 self.label = QLabel()35 self.pixmap = QPixmap(image_path)36 self.label.setPixmap(self.pixmap)37 self.setCentralWidget(self.label)38 self.resize(self.pixmap.size())3940 def mousePressEvent(self, event: QMouseEvent):41 x, y = event.pos().x(), event.pos().y()42 print(f"Clicked: ({x}, {y})")43 self.coords.append((x, y))4445 if __name__ == '__main__':46 app = QApplication(sys.argv)47 picker = PixelPicker(sys.argv[1])48 picker.show()49 app.exec()50 ```51522. **Run the picker**53 ```bash54 python3 pixel_pick.py /path/to/image.png55 ```56573. **Click on elements to get coordinates**58 - Each click prints (x, y) to terminal59 - Coordinates are relative to image top-left6061## Output Format6263```64Clicked: (384, 208)65Clicked: (418, 208)66Clicked: (452, 208)67```6869## Generating Layout Code7071After collecting coordinates, generate code:7273```python74# Convert clicks to _box() calls75coords = [(384, 208), (418, 208), (452, 208)]76for i, (x, y) in enumerate(coords):77 print(f'"BUTTON_{i}": _box({x}, {y}, 28, 20),')78```7980## Tips8182- Click top-left corner of each button83- Note the pattern/spacing for similar buttons84- Use grid overlay (/align-debug) first for reference