ViewAnyFile Logo
ViewAnyFileClient-Side File Studio

📷 Document Scanner

Scan multi-page documents with your camera or upload photos — perspective correction, auto-enhance, export as PDF, ZIP, JPG, or PNG. 100% in-browser, private, free.

1
Capture
2
Adjust
3
Result
or

Technical Architecture: How 4-Point Homography & Adaptive Thresholding Work

When you photograph a paper contract, receipt, or whiteboard with a smartphone or webcam, the camera lens rarely sits perfectly perpendicular to the page. This introduces projective distortion (keystoning), where rectangular paper edges converge into a trapezoid and uneven room lighting casts shadows across the text.

ViewAnyFile.app’s Document Scanner solves both problems entirely inside your browser using the HTML5 MediaDevices API (`getUserMedia`) and custom Canvas 2D projective geometry:

  • 3x3 Homography Matrix Warping: By selecting the four physical corners of your document `(x0, y0)...(x3, y3)`, our engine computes a projective transformation matrix that maps the arbitrary quadrilateral back onto an orthogonal A4/Letter aspect-ratio rectangle using bilinear pixel interpolation.
  • Illumination Normalization & Contrast Stretch: In Enhanced and B&W Document modes, the scanner evaluates local luminance histograms to suppress paper grain and uneven desk shadows while boosting ink contrast to crisp black-on-white legibility.
  • Multi-Page PDF Packaging: Scanned pages are encoded as JPEG/PNG streams and embedded directly into a multi-page ISO 32000-1 PDF container in browser memory — ideal for signing contracts, submitting expense receipts, or archiving lecture notes without installing mobile scanner apps that watermark or upload your files.

Frequently Asked Questions

Does the camera stream ever leave my device?
Never. The video feed from navigator.mediaDevices.getUserMedia is drawn directly onto a local HTML5 <canvas> element in your browser tab. Zero frames or document photos are transmitted over the network.

Can I upload an existing photo from my phone gallery or desktop?
Yes. You can either capture a live frame using your device camera or drop existing JPG, PNG, WebP, or HEIC photos of documents to straighten and convert them into a single PDF.

Related Tools: Need to combine your scanned PDF with other documents? Use our PDF Merger or PDF Watermark Tool.