HNHacker News
TopNewBestAskShowJobs

seedgou

378 karma · joined October 27, 2021

<github.com/rwv>
submissionscomments
seedgou··on Show HN: Make your PDF look scanned in browser
Oh! You mean the scanning speed. I thought you was talking about the original PDF preview. For now, scanning is using emscriptened ImageMagick Wasm. Due to the translation from C++ to Wasm, the scanning speed is very slow. Maybe re-writing blur, rotate and noise algorithm will speed up the scanning.
seedgou··on Show HN: Make your PDF look scanned in browser
The rendering logic is in `src/utils/pdf/renderPage.ts` and has only 26 lines.
seedgou··on Show HN: Make your PDF look scanned in browser
The site's logic is nearly identical to this gist: use ImageMagick to do the rotate, noise, etc.
seedgou··on Show HN: Make your PDF look scanned in browser
GitHub URL: https://github.com/rwv/lookscanned.io
seedgou··on Show HN: Make your PDF look scanned in browser
Good idea! A random distribution on rotation seems a more user-friendly way instead of setting 10 rotation values.
seedgou··on Show HN: Make your PDF look scanned in browser
I didn't manipulate the data in pixel level. Maybe because I render PDF in 2x which causes 4x more pixels?
seedgou··on Show HN: Make your PDF look scanned in browser
There's an example PDF after clicking "START SCANNING" button. Maybe add more real-world examples.
seedgou··on Show HN: Make your PDF look scanned in browser
This is inspired by baicunko/scanyourpdf and previous HN link: https://news.ycombinator.com/item?id=23157408
seedgou··on Show HN: Make your PDF look scanned in browser
Use PDF.js and magica to do the rendering and processing. You could see the credits in GitHub repo page.