Conversation
klep
left a comment
There was a problem hiding this comment.
Great enhancements! Some minor comments and questions, but looks great!
scanline/IntExtensions.swift
Outdated
| // scanline | ||
| // | ||
| // Created by Florian Dreier on 12/30/19. | ||
| // Copyright © 2019 Scott J. Kleper. All rights reserved. |
There was a problem hiding this comment.
I should probably go and remove this everywhere, maybe just pointing to the LICENSE file. Feel free to omit this line. My name doesn't need to be on everything!
There was a problem hiding this comment.
This was just the default header that XCode generated. I replaced the headers now with
//
// This code is part of scanline and published under MIT license.
//
WDYT?
scanline/ArrayExtensions.swift
Outdated
|
|
||
| extension Array where Iterator.Element == Int { | ||
|
|
||
| func doesValueAroundIndexPassFivePercent(index: Int, total: Int) -> Bool { |
There was a problem hiding this comment.
A comment for this function would be helpful. I'm not 100% sure I get what it's doing
There was a problem hiding this comment.
I didn't like this method either. Took this as a chance to refactor the code so that the method is no longer needed. Hope this makes things clearer.
| @@ -0,0 +1,18 @@ | |||
| // | |||
| // UIImageExtensions.swift | |||
| import Foundation | ||
|
|
||
| /// Describes insets that can be applied to a rectangle. | ||
| struct Insets { |
There was a problem hiding this comment.
AFAICS UIEdgeInsets is only part of UIKit, which is not linked against scanline as it is a command line application.
|
Thanks for your review! |
Now opens all scanned images in a single window
| @"synonyms": @[@"size"], | ||
| @"type": @"string", | ||
| @"description": @"Specify the size of the area that should be scanned in cm (Default is the whole flatbed scan area)" | ||
| @"description": @"Specify the size of the area that should be scanned in cm. Forat is <width>x<height>, e.g. 20x20 (Default is the whole flatbed scan area)" |
| guard error == nil else { | ||
| logger.log("Error received while attempting to open a session with the scanner.") | ||
| delegate?.scannerControllerDidFail(self) | ||
| if(configuration.batchScan) { |
There was a problem hiding this comment.
| if(configuration.batchScan) { | |
| if configuration.batchScan { |
|
|
||
| logger.log("Error received while attempting to close a session with the scanner.") | ||
| delegate?.scannerControllerDidFail(self) | ||
| if(configuration.batchScan) { |
There was a problem hiding this comment.
| if(configuration.batchScan) { | |
| if configuration.batchScan { |
| #import <XCTest/XCTest.h> | ||
|
|
||
| #import "ScanConfiguration.h" | ||
| #import "../scanline/ScanConfiguration.h" |
There was a problem hiding this comment.
I was able to get it to work by doing the following:
- Change to
#import "ScanConfiguration.h"inScanConfigurationTests.m - Remove everything except
ScanConfigurationTests.mandScanConfiguration.mfrom theCompile Sourcesstep - Remove
#import "scanline-Swift.h"fromScanConfiguration.m
It's not ideal -- we shouldn't need any of the app source files in the test target -- but I'm not sure what the issue is right now with that.
| import Foundation | ||
|
|
||
| /// Describes insets that can be applied to a rectangle. | ||
| struct Insets { |
|
|
||
| init(fromString insets: String) { | ||
| let insetValues = insets.split(separator: ":") | ||
| self.init(left: Double(insetValues[0])!, top: Double(insetValues[1])!, right: Double(insetValues[2])!, bottom: Double(insetValues[1])!) |
There was a problem hiding this comment.
Is it possible to avoid the force unwraps here?
|
|
||
| CFRunLoopRun() | ||
|
|
||
| print("Done") |
|
Hey @klep, I noticed that this PR was last updated in 2020, but there was a recent v2.0 release this year. I'm not sure how many enhancements were made between v1.0 and v2.0, but I was wondering where that leaves this PR and its enhancements. Thank you! |
|
@rramphal It looks like there were some comments that were not addressed. These do look like worthy changes, but they'd have to be adapted for the newer version... |
Hi Scott,
Thanks for your work on this tool.
I found it very useful and a good starting point for my own needs. I'm currently digitalizing a bunch of old printed photos. To make this easier I added some enhancements to scanline that might also be useful for others.
Enhancements are:
Additionally I have done some refactorings/cleanup:
Let me know what you think 🙂
P.S. I would suggest to look at the changes commit by commit.