Repo for the search and displace ingest module that takes odf, docx and pdf and transforms it into .md to be used with search and displace operations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
6.0 KiB

3 years ago
  1. Deskew
  2. =======================
  3. by Marek Mauder \
  4. <http://galfar.vevb.net/deskew> \
  5. <https://bitbucket.org/galfar/app-deskew> \
  6. <https://github.com/galfar/deskew>
  7. **v1.30 2018-06-07**
  8. Overview
  9. ------------------------
  10. Deskew is a command line tool for deskewing scanned text documents.
  11. It uses Hough transform to detect "text lines" in the image. As an output, you
  12. get an image rotated so that the lines are horizontal.
  13. There are binaries built for these platforms (located in Bin folder):
  14. Win64 (`deskew.exe`), Win32 (`deskew32.exe`), Linux 64bit (`deskew`), macOS (`deskew-mac`), Linux ARMv7 (`deskew-arm`).
  15. GUI frontend for this CLI tool is available as well (Windows, Linux, and macOS).
  16. License: MIT
  17. ### Downloads And Releases
  18. <https://github.com/galfar/deskew/releases> \
  19. <https://bitbucket.org/galfar/app-deskew/downloads/>
  20. Usage
  21. ------------------------
  22. ```console
  23. Usage:
  24. deskew [-o output] [-a angle] [-b color] [..] input
  25. input: Input image file
  26. Options:
  27. -o output: Output image file (default: out.png)
  28. -a angle: Maximal expected skew angle (both directions) in degrees (default: 10)
  29. -b color: Background color in hex format RRGGBB|LL|AARRGGBB (default: black)
  30. Ext. options:
  31. -q filter: Resampling filter used for rotations (default: linear,
  32. values: nearest|linear|cubic|lanczos)
  33. -t a|treshold: Auto threshold or value in 0..255 (default: a)
  34. -r rect: Skew detection only in content rectangle (pixels):
  35. left,top,right,bottom (default: whole page)
  36. -f format: Force output pixel format (values: b1|g8|rgb24|rgba32)
  37. -l angle: Skip deskewing step if skew angle is smaller (default: 0.01)
  38. -g flags: Operational flags (any combination of):
  39. c - auto crop, d - detect only (no output to file)
  40. -s info: Info dump (any combination of):
  41. s - skew detection stats, p - program parameters, t - timings
  42. -c specs: Output compression specs for some file formats. Several specs
  43. can be defined - delimited by commas. Supported specs:
  44. jXX - JPEG compression quality, XX is in range [1,100(best)]
  45. tSCHEME - TIFF compression scheme: none|lzw|rle|deflate|jpeg|g4
  46. Supported file formats
  47. Input: BMP, JPG, PNG, JNG, GIF, DDS, TGA, PBM, PGM, PPM, PAM, PFM, TIF, PSD
  48. Output: BMP, JPG, PNG, JNG, GIF, DDS, TGA, PGM, PPM, PAM, PFM, TIF, PSD
  49. ```
  50. ### Notes
  51. For TIFF support in Linux and macOS you need to have libtiff 4.x installed (package is usually called libtiff5).
  52. For macOS you can download prebuilt libtiff binaries here: <https://bitbucket.org/galfar/app-deskew/downloads/TiffLibBins-macOS.zip>. Just put the files inside the archive to the same folder as `deskew-mac` executable.
  53. You can find some test images in TestImages folder and
  54. scripts to run tests (`RunTests.bat` and `runtests.sh`) in Bin.
  55. By default scripts just call `deskew` command but you can pass a different one as a parameter
  56. (e.g. `runtests.sh deskew-arm`).
  57. ### Bugs, Issues, Proposals
  58. File them here: \
  59. <https://bitbucket.org/galfar/app-deskew/issues> \
  60. <https://github.com/galfar/deskew/issues>
  61. Version History
  62. ------------------------
  63. v1.30 2019-06-07:
  64. - fix #15: Better image quality after rotation - better default and also selectable nearest|linear|cubic|lanczos filtering
  65. - fix #5: Detect skew angle only (no rotation done) - optionally only skew detection
  66. - fix #17: Optional auto-crop after rotation
  67. - fix #3: Command line option to set output compression - now for TIFF and JPEG
  68. - fix #12: Bad behavior when an output is given and no deskewing is needed
  69. - libtiff in macOS is now picked up also when binaries are put directly in the directory with deskew
  70. - text output is flushed after every write (Linux/Unix): it used to be flushed only when writing to device but not file/pipe.
  71. v1.25 2018-05-19:
  72. - fix #6: Preserve DPI measurement system (TIFF)
  73. - fix #4: Output image not saved in requested format (when deskewing is skipped)
  74. - dynamic loading of libtiff library - adds TIFF support in macOS when libtiff is installed
  75. v1.21 2017-11-01:
  76. - fix #8: Cannot compile in Free Pascal 3.0+ (Windows) - Fails to link precompiled LibTiff library
  77. - fix #7: Windows FPC build fails with *Access violation exception* when loading certain TIFFs (especially those saved by Windows Photo Viewer etc.)
  78. v1.20 2016-09-01:
  79. - much faster rotation, especially when background color is set (>2x faster, 2x less memory)
  80. - can skip deskewing step if detected skew angle is lower than parameter
  81. - new option for timing of individual steps
  82. - fix: crash when last row of page is classified as text
  83. - 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
  84. v1.10 2014-03-04:
  85. - TIFF support for Win64 and 32/64bit Linux
  86. - forced output formats
  87. - fix: output file names were always lowercase
  88. - fix: preserves resolution metadata (e.g. 300dpi) of input when writing output
  89. v1.00 2012-06-04:
  90. - background color
  91. - "area of interest" content rectangle
  92. - 64bit and Mac OSX support
  93. - PSD and TIFF (win32) support
  94. - show skew detection stats and program parameters
  95. v0.95 2010-12-28:
  96. - Added auto thresholding
  97. v0.90 2010-02-12:
  98. - Initial version
  99. Compiling Deskew
  100. ------------------------
  101. Deskew is written in Object Pascal. You need Free Pascal or Delphi to recompile it.
  102. ### Tested Compilers
  103. There are project files for these IDEs:
  104. 1. Lazarus 2.0.2 (deskew.lpi)
  105. 2. Delphi XE + 10.3 (deskew.dproj)
  106. Additionally, there are compile shell/batch scripts for standalone FPC compiler in `Scripts` folder.
  107. ### Supported/Tested Platforms
  108. Deskew is precompiled and was tested on these platforms:
  109. Win32, Win64, Linux 64bit, macOS 64bit, Linux ARMv7
  110. ### Source Code
  111. Latest source code can be found here: \
  112. <https://bitbucket.org/galfar/app-deskew> \
  113. <https://github.com/galfar/deskew>
  114. ### Dependencies
  115. Vampyre Imaging Library is needed for compilation and it's included in Deskew's repo in Imaging folder.