Public repo note: keep this file technical. Business strategy, legal notes, beta tester info, and anything personal lives OUTSIDE this repository. Never paste tokens or API keys into files or commit messages.
ArtCheck is a web app for promotional products suppliers that automates art file screening (previews, color analysis, production suitability) before files reach the art department.
Live app: https://www.artcheck.app (Railway — NOT Streamlit Cloud)
Main file: app_with_embroidery.py — this is what runs in production.
- Python + Streamlit 1.43.2 (pinned — do NOT unpin, 1.55 broke the app)
- PyMuPDF (fitz) — PDF/AI renderer (dynamic scale to 1200px min, alpha=True for bg support)
- Ghostscript — EPS renderer (pngalpha device) + EPS color extraction (GS→PDF→fitz pipeline)
- CairoSVG — SVG renderer; pdf2image — PDF fallback
- pyembroidery — embroidery files; Pillow — compositing
- Anthropic Claude API — ArtBot; key in Railway env var
ANTHROPIC_API_KEY
- Vector: .ai, .eps, .pdf, .svg, .cdr, .xcf
- Embroidery: .dst, .pes, .exp, .jef, .vp3, .xxx, .u01
- Raster: .png, .jpg, .jpeg, .gif, .tiff, .bmp, .webp
- Not supported: .indd (user shown export instructions)
EPS: Ghostscript (pngalpha, 300 DPI, -dEPSCrop) → fitz fallback.
PDF/AI: fitz (dynamic scale, alpha=True) → pdf2image fallback.
SVG: detect embedded raster → fitz or CairoSVG.
Embroidery: pyembroidery → PIL visualization.
Background via _apply_background(output_file, bg_type); both fitz (alpha=True)
and GS (pngalpha) must render with transparency for backgrounds to work.
Reads DPI from Pillow metadata, computes usable print sizes at 300/200/150 DPI, verdicts (Production Ready / Marginal / Not Suitable), flags 72 DPI as likely web graphics, recommends what to request from the customer.
Display rules (critical):
- Spot colors found → Pantone names ONLY, suppress RGB/CMYK fills
- CMYK doc, no spots → CMYK values, suppress RGB
- Genuinely RGB doc → RGB with red warning badge (RGB is useless in promo production)
PDF/AI pipeline: fitz get_drawings() → xref scan for /Separation
colorspaces → raw byte scan for PANTONE strings → decompressed content-stream
scan for scn/k operators → CMYK-from-stream overrides xref DeviceRGB artifacts.
EPS pipeline: GS pdfwrite → fitz content stream → parse k/scn →
spot names from original EPS text (printable-ASCII filter for binary garbage).
Key operators: Illustrator AI/PDF uses scn; GS-converted EPS uses k;
plain PostScript uses setcmykcolor/setgray.
Senior production artist persona; sees uploaded file context (colors, dims,
warnings) injected into the system prompt. st.form for Enter-to-send, key
rotation to clear input, artbot_pending → rerun pattern, streaming via
client.messages.stream(). Session state: artbot_history, artbot_pending,
artbot_input_key, bg_type.
static/mockup.html served through components.html(); ?mockup=1 route.
Handoff via @st.cache_resource dict — single-use tokens, 5-minute expiry.
railway.toml: healthcheck/_stcore/health(120s), restart on_failure ×3- Railway env var
PORT=8501set manually; domainwww.artcheck.app→ container :8501 - Push to
main→ Railway auto-deploys. Every push to main goes straight to production. inject_ga.pyruns at container start: patches Streamlit's index.html with branded title + SEO/OG meta tags + GA4 + a 20s health-ping keepalive
Railway's proxy drops idle WebSockets. Three layers:
- Tornado server-side WS pings
- Client health ping injected by
inject_ga.py start.shflags:enableWebsocketCompression=false,fileWatcherType=none,browser.serverAddress=www.artcheck.app,browser.serverPort=443
streamlit==1.43.2— 1.55 broke the apppymupdf==1.26.5,cairosvg==2.8.2— later "versions" were phantom/nonexistent on PyPI- Dockerfile uses runtime libs only (
libcairo2,libpangocairo-1.0-0) —-devheaders pull ~100 packages and cause boot timeouts
- Keep heavy imports (cairosvg, fitz, pdf2image) lazy — inside methods
@st.cache_resourceonPreviewGenerator/ColorExtractor— do not remove
git clone https://github.com/Shernandez520/artcheck.git
# edit app_with_embroidery.py (the production file)
git add <files> && git commit -m "..." && git push # deploys immediatelyMonitor deploys in the Railway dashboard. Test file uploads (EPS + PDF + PNG) after every deploy — upload is the core feature.
| Method | File Needs | Key Limits |
|---|---|---|
| Screen Print | Vector, spot colors | 4-6 colors max |
| Embroidery | .dst/.pes or digitizing | Max ~12K stitches left chest |
| DTG | Raster OK, 300 DPI | Best on cotton/light |
| Laser Etch | Vector only | Single color, line art |
| Heat Transfer | Vector, solid colors | Min detail 0.125" |
| Dye Sub | Full color RGB | Polyester only, 300 DPI+ |
| Pad Print | Vector, spot colors | 1-4 colors, small areas |