From c27f99ab589ed7233649527be2611e558df76f29 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Fri, 12 May 2023 20:42:45 +0100 Subject: [PATCH] 99.9 for blanks --- scripts/detect-blank-pages.py | 2 +- .../software/SPDF/controller/api/other/BlankPageController.java | 2 +- src/main/resources/templates/other/remove-blanks.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/detect-blank-pages.py b/scripts/detect-blank-pages.py index 05a358ad9..69b7f9d5f 100644 --- a/scripts/detect-blank-pages.py +++ b/scripts/detect-blank-pages.py @@ -27,7 +27,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description='Detect if an image is considered blank or not.') parser.add_argument('image_path', help='The path to the image file.') parser.add_argument('-t', '--threshold', type=int, default=10, help='Threshold for determining white pixels. The default value is 10.') - parser.add_argument('-w', '--white_percent', type=int, default=99, help='The percentage of white pixels for an image to be considered blank. The default value is 99.') + parser.add_argument('-w', '--white_percent', type=float, default=99, help='The percentage of white pixels for an image to be considered blank. The default value is 99.') args = parser.parse_args() blank = is_blank_image(args.image_path, args.threshold, args.white_percent) diff --git a/src/main/java/stirling/software/SPDF/controller/api/other/BlankPageController.java b/src/main/java/stirling/software/SPDF/controller/api/other/BlankPageController.java index 5e538281a..e43fc60be 100644 --- a/src/main/java/stirling/software/SPDF/controller/api/other/BlankPageController.java +++ b/src/main/java/stirling/software/SPDF/controller/api/other/BlankPageController.java @@ -36,7 +36,7 @@ public class BlankPageController { @PostMapping(consumes = "multipart/form-data", value = "/remove-blanks") public ResponseEntity<byte[]> removeBlankPages(@RequestPart(required = true, value = "fileInput") MultipartFile inputFile, @RequestParam(defaultValue = "10", name = "threshold") int threshold, - @RequestParam(defaultValue = "99", name = "whitePercent") int whitePercent) throws IOException, InterruptedException { + @RequestParam(defaultValue = "99.9", name = "whitePercent") float whitePercent) throws IOException, InterruptedException { PDDocument document = null; try { document = PDDocument.load(inputFile.getInputStream()); diff --git a/src/main/resources/templates/other/remove-blanks.html b/src/main/resources/templates/other/remove-blanks.html index 7fd6526b0..1bfffc0b7 100644 --- a/src/main/resources/templates/other/remove-blanks.html +++ b/src/main/resources/templates/other/remove-blanks.html @@ -23,7 +23,7 @@ </div> <div class="form-group"> <label for="whitePercent" th:text="#{removeBlanks.whitePercent}"></label> - <input type="number" class="form-control" id="whitePercent" name="whitePercent" value="99"> + <input type="number" class="form-control" id="whitePercent" name="whitePercent" value="99.9" step="0.1"> <small id="whitePercentHelp" class="form-text text-muted" th:text="#{removeBlanks.whitePercentDesc}"></small> </div> <button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{removeBlanks.submit}"></button>