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>.4lifecycle: experimental5---67# Pixel Pick Skill89Interactive tool to click on an image and get exact pixel coordinates.1011## Usage1213```14/pixel-pick /path/to/image.png15/pixel-pick /path/to/image.png --output coords.json16```1718## Process19201. **Create interactive picker script**21 ```python22 #!/usr/bin/env python323 """Click on image to get coordinates."""24 import sys25 from PyQt6.QtWidgets import QApplication, QLabel, QMainWindow26 from PyQt6.QtGui import QPixmap, QMouseEvent27 from PyQt6.QtCore import Qt2829 class PixelPicker(QMainWindow):30 def __init__(self, image_path):31 super().__init__()32 self.setWindowTitle(f"Pixel Picker - {image_path}")33 self.coords = []3435 self.label = QLabel()36 self.pixmap = QPixmap(image_path)37 self.label.setPixmap(self.pixmap)38 self.setCentralWidget(self.label)39 self.resize(self.pixmap.size())4041 def mousePressEvent(self, event: QMouseEvent):42 x, y = event.pos().x(), event.pos().y()43 print(f"Clicked: ({x}, {y})")44 self.coords.append((x, y))4546 if __name__ == '__main__':47 app = QApplication(sys.argv)48 picker = PixelPicker(sys.argv[1])49 picker.show()50 app.exec()51 ```52532. **Run the picker**54 ```bash55 python3 pixel_pick.py /path/to/image.png56 ```57583. **Click on elements to get coordinates**59 - Each click prints (x, y) to terminal60 - Coordinates are relative to image top-left6162## Output Format6364```65Clicked: (384, 208)66Clicked: (418, 208)67Clicked: (452, 208)68```6970## Generating Layout Code7172After collecting coordinates, generate code:7374```python75# Convert clicks to _box() calls76coords = [(384, 208), (418, 208), (452, 208)]77for i, (x, y) in enumerate(coords):78 print(f'"BUTTON_{i}": _box({x}, {y}, 28, 20),')79```8081## Tips8283- Click top-left corner of each button84- Note the pattern/spacing for similar buttons85- Use grid overlay (/align-debug) first for reference