{"id":13415723,"url":"https://github.com/galfar/deskew","last_synced_at":"2025-03-14T23:31:05.105Z","repository":{"id":51359991,"uuid":"155421176","full_name":"galfar/deskew","owner":"galfar","description":"Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect \"text lines\" in the image. As an output, you get an image rotated so that the lines are horizontal.","archived":false,"fork":false,"pushed_at":"2024-07-24T23:06:31.000Z","size":9443,"stargazers_count":161,"open_issues_count":22,"forks_count":26,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-07-31T21:54:32.699Z","etag":null,"topics":["delphi","deskewing","free-pascal","lazarus","object-pascal","pascal","scanning","utility"],"latest_commit_sha":null,"homepage":"http://galfar.vevb.net/deskew","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/galfar.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/marekmauder","https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=T5XRJKZWVMPMN\u0026item_name=Donation+to+Deskew\u0026currency_code=USD"]}},"created_at":"2018-10-30T16:37:58.000Z","updated_at":"2024-07-28T13:02:11.000Z","dependencies_parsed_at":"2024-01-15T23:26:59.172Z","dependency_job_id":"bd4e736f-04d5-42f0-a549-304b529f6ab2","html_url":"https://github.com/galfar/deskew","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galfar%2Fdeskew","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galfar%2Fdeskew/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galfar%2Fdeskew/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/galfar%2Fdeskew/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/galfar","download_url":"https://codeload.github.com/galfar/deskew/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663450,"owners_count":20327299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delphi","deskewing","free-pascal","lazarus","object-pascal","pascal","scanning","utility"],"created_at":"2024-07-30T21:00:51.614Z","updated_at":"2025-03-14T23:31:04.141Z","avatar_url":"https://github.com/galfar.png","language":"Pascal","funding_links":["https://paypal.me/marekmauder","https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=T5XRJKZWVMPMN\u0026item_name=Donation+to+Deskew\u0026currency_code=USD"],"categories":["2. \u003ca name='DeskewingandDewarping'\u003e\u003c/a\u003eDeskewing and Dewarping","Deskewing and Dewarping"],"sub_categories":["1.4. \u003ca name='OCRCLI'\u003e\u003c/a\u003eOCR CLI"],"readme":"Deskew\r\n=======================\r\n\r\nby Marek Mauder  \r\n\u003chttps://galfar.vevb.net/deskew\u003e  \r\n\u003chttps://github.com/galfar/deskew\u003e  \r\n\r\n**v1.30 2019-06-07**\r\n\r\nOverview\r\n------------------------\r\n\r\nDeskew is a command line tool for deskewing scanned text documents.\r\nIt uses Hough transform to detect \"text lines\" in the image. As an output, you\r\nget an image rotated so that the lines are horizontal.\r\n\r\nThere are pre-compiled binaries built for these platforms (located in Bin folder):\r\nWin64 (`deskew.exe`), Win32 (`deskew32.exe`), Linux x86_64 (`deskew`), macOS x86_64 (`deskew-mac`), Linux ARM aarch64 (`deskew-arm64`) and v7 (`deskew-arm`).\r\n\r\nGUI frontend for this CLI tool is available as well (Windows, Linux, and macOS), see [GUI's Readme](Gui/Readme.md).\r\n\r\nLicense: MPL 2.0\r\n\r\n### Downloads And Releases\r\n\r\n\u003chttps://github.com/galfar/deskew/releases\u003e  \r\n\u003chttps://galfar.vevb.net/deskew#downloads\u003e  \r\n\r\nUsage\r\n------------------------\r\n\r\n```console\r\nUsage:\r\ndeskew [-o output] [-a angle] [-b color] [..] input\r\n    input:         Input image file\r\n  Options:\r\n    -o output:     Output image file (default: out.png)\r\n    -a angle:      Maximal expected skew angle (both directions) in degrees (default: 10)\r\n    -b color:      Background color in hex format RRGGBB|LL|AARRGGBB (default: black)\r\n  Ext. options:\r\n    -q filter:     Resampling filter used for rotations (default: linear,\r\n                   values: nearest|linear|cubic|lanczos)\r\n    -t a|treshold: Auto threshold or value in 0..255 (default: a)\r\n    -r rect:       Skew detection only in content rectangle (pixels):\r\n                   left,top,right,bottom (default: whole page)\r\n    -f format:     Force output pixel format (values: b1|g8|rgb24|rgba32)\r\n    -l angle:      Skip deskewing step if skew angle is smaller (default: 0.01)\r\n    -g flags:      Operational flags (any combination of):\r\n                   c - auto crop, d - detect only (no output to file)\r\n    -s info:       Info dump (any combination of):\r\n                   s - skew detection stats, p - program parameters, t - timings\r\n    -c specs:      Output compression specs for some file formats. Several specs\r\n                   can be defined - delimited by commas. Supported specs:\r\n                   jXX - JPEG compression quality, XX is in range [1,100(best)]\r\n                   tSCHEME - TIFF compression scheme: none|lzw|rle|deflate|jpeg|g4\r\n\r\n  Supported file formats\r\n    Input:  BMP, JPG, PNG, JNG, GIF, DDS, TGA, PBM, PGM, PPM, PAM, PFM, TIF, PSD\r\n    Output: BMP, JPG, PNG, JNG, GIF, DDS, TGA, PGM, PPM, PAM, PFM, TIF, PSD\r\n```\r\n\r\n### Notes\r\n\r\nFor TIFF support in Linux and macOS you need to have libtiff 4.x installed (package is usually called libtiff5).\r\n\r\nFor macOS you can download prebuilt libtiff binaries here: \u003chttps://galfar.github.io/store/TiffLibBins-macOS.zip\u003e. Just put the files inside the archive to the same folder as `deskew-mac` executable.\r\n\r\nOn ARM targets linking to libtiff is disabled at the moment (known\r\nto crash with deskew). If you want to try yourself enable it in `ImagingTiff.pas` unit.\r\n\r\nYou can find some test images in TestImages folder and\r\nscripts to run tests (`RunTests.bat` and `runtests.sh`) in Bin.\r\nBy default scripts just call `deskew` command but you can pass a different one as a parameter\r\n(e.g. `runtests.sh deskew-arm`).\r\n\r\n### Bugs, Issues, Proposals\r\n\r\nFile them here:  \r\n\u003chttps://github.com/galfar/deskew/issues\u003e\r\n\r\n\r\nVersion History\r\n------------------------\r\n\r\nv1.30 2019-06-07:\r\n\r\n- fix #15: Better image quality after rotation - better default and also selectable nearest|linear|cubic|lanczos filtering\r\n- fix #5: Detect skew angle only (no rotation done) - optionally only skew detection\r\n- fix #17: Optional auto-crop after rotation\r\n- fix #3: Command line option to set output compression - now for TIFF and JPEG\r\n- fix #12: Bad behavior when an output is given and no deskewing is needed\r\n- libtiff in macOS is now picked up also when binaries are put directly in the directory with deskew\r\n- text output is flushed after every write (Linux/Unix): it used to be flushed only when writing to device but not file/pipe.\r\n\r\nv1.25 2018-05-19:\r\n\r\n- fix #6: Preserve DPI measurement system (TIFF)\r\n- fix #4: Output image not saved in requested format (when deskewing is skipped)\r\n- dynamic loading of libtiff library - adds TIFF support in macOS when libtiff is installed\r\n\r\nv1.21 2017-11-01:\r\n\r\n- fix #8: Cannot compile in Free Pascal 3.0+ (Windows) - Fails to link precompiled LibTiff library\r\n- fix #7: Windows FPC build fails with *Access violation exception* when loading certain TIFFs (especially those saved by Windows Photo Viewer etc.)\r\n\r\nv1.20 2016-09-01:\r\n\r\n- much faster rotation, especially when background color is set (\u003e2x faster, 2x less memory)\r\n- can skip deskewing step if detected skew angle is lower than parameter\r\n- new option for timing of individual steps\r\n- fix: crash when last row of page is classified as text\r\n- misc: default back color is now opaque black, new forced output format  \"rgb24\",  background color can define also alpha channel, nicer formatting of text output\r\n\r\nv1.10 2014-03-04:\r\n\r\n- TIFF support for Win64 and 32/64bit Linux\r\n- forced output formats\r\n- fix: output file names were always lowercase\r\n- fix: preserves resolution metadata (e.g. 300dpi) of input when writing output\r\n\r\nv1.00 2012-06-04:\r\n\r\n- background color\r\n- \"area of interest\" content rectangle\r\n- 64bit and Mac OSX support\r\n- PSD and TIFF (win32) support\r\n- show skew detection stats and program parameters\r\n\r\nv0.95 2010-12-28:\r\n\r\n- Added auto thresholding\r\n\r\nv0.90 2010-02-12:\r\n\r\n- Initial version\r\n\r\n\r\nCompiling Deskew\r\n------------------------\r\n\r\nDeskew is written in Object Pascal. You need Free Pascal or Delphi to recompile it.\r\n\r\n### Tested Compilers\r\n\r\nThere are project files for these IDEs:\r\n\r\n  1. Lazarus 2.2.2 (deskew.lpi)\r\n  2. Delphi XE + 10.3 (deskew.dproj)\r\n\r\nAdditionally, there are compile shell/batch scripts for standalone FPC compiler in `Scripts` folder.\r\n\r\n### Supported/Tested Platforms\r\n\r\nDeskew can be compiled and was tested on these platforms:\r\nWin32, Win64, Linux x86_64, macOS x86_64, Linux ARM aarch64 + v7.\r\n\r\n### Source Code\r\n\r\nLatest source code can be found here:  \r\n\u003chttps://github.com/galfar/deskew\u003e\r\n\r\n### Dependencies\r\n\r\nVampyre Imaging Library is needed for compilation and it's included in Deskew's repo in Imaging folder.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalfar%2Fdeskew","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgalfar%2Fdeskew","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalfar%2Fdeskew/lists"}