Skip to content

Commit f2ca544

Browse files
Merge pull request #19 from MechTechnology/dev
Updates main to V3.1 - Community Patch
2 parents fc3b750 + 2d72b98 commit f2ca544

18 files changed

+537
-252
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pillow = "*"
1616
numpy = "*"
1717
pyside6 = "*"
1818
pyqtdarktheme = "*"
19+
psd-tools = "*"
1920

2021
[dev-packages]
2122
flake8 = "*"

Pipfile.lock

Lines changed: 456 additions & 202 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<a href="https://github.com/MechTechnology/SmartStitch">
3-
<img alt="SmartStitch.Logo" width="200" heigth="200" src="https://github.com/MechTechnology/SmartStitch/raw/dev/assets/SmartStitchLogo.png">
3+
<img alt="SmartStitch.Logo" width="200" height="200" src="https://github.com/MechTechnology/SmartStitch/raw/dev/assets/SmartStitchLogo.png">
44
</a>
55
<h1>SmartStitch</h1>
66
<p>
@@ -46,7 +46,7 @@ The smart part of the name comes from the fact that it uses some simple pixel ca
4646
## Basic Quick Get Started GUI Version
4747
1. Open the application.
4848
2. Browse to your raw folder.
49-
4. Select a the output file type. (Supported types: png, jpg, webp, bmp, tiff, tga)
49+
4. Select a the output file type. (Supported types: png, jpg, webp, bmp, psd, tiff, tga)
5050
3. Set the Rough Panel Height of the output files.
5151
5. Click start process.
5252
6. Done, Enjoy!
@@ -71,7 +71,7 @@ The smart part of the name comes from the fact that it uses some simple pixel ca
7171
Keep in mind that this setup is only needed once, after running the setup.py, you can just launch ```SmartStitchGUI.py``` directly every time
7272

7373
## Reporting Bugs [New to 3.0+]:
74-
A very robust logging system has been implemented in the GUI version of SmartStitch for almost every interaction with the program, when an error occur the application will inform you about it, and leaves the details in a file called in the ```__logs__``` folder, There will be a file created for every day of usage. you can open an issue ticket here and attach the file, so it can be easily debugged and fixed.
74+
A very robust logging system has been implemented in the GUI version of SmartStitch for almost every interaction with the program, when an error occur the application will inform you about it, and leaves the details in a file called in the ```__logs__``` folder, There will be a file created for every day of usage. you can open an issue ticket here and attach the file, so it can be easily debugged and fixed.
7575

7676
And since it's just one person maintaining this application, only accepted tickets will be for version 3.0 and above. Please don't open tickets for lower versions, since your problem could have been already solved.
7777

@@ -83,17 +83,17 @@ You can also contact me at Discord if you don't want to use the GitHub Issue Sys
8383
Here is the complete documentation for the application, it is broken down into 4 sections, basic settings, advanced settings, how to build your own version, how to run the console version.
8484

8585
## Basic Settings
86-
These are the required settings that all users should be mindful of.
86+
These are the required settings that all users should be mindful of.
8787

8888
### Input Folder Path
8989
Here you have to set the path for the Input Folder which contains the raws that will be processed by the program. If batch mode is enabled, it will search for subfolder within the given input path. So make sure your folder and files are in order.
9090

9191
*Console Parameter Name: --input_folder, -i*
9292

9393
### Output type
94-
The default output type is png since it is lossless, however you can always change to other types, such as jpg, the program does save jpg at 100 quality, so there should be not noticable loss in quality but it is up to the user what format they want.
94+
The default output type is png since it is lossless, however you can always change to other types, such as jpg, the program does save jpg at 100 quality, so there should be not noticeable loss in quality but it is up to the user what format they want. (You can also now use PSD files for convenience if you are a Photoshop user, however output files will not contain the layers of the original input psd file)
9595

96-
*Default: .png* --- *Supported Types: png, jpg, webp, bmp, tiff, tga* --- *Console Parameter Name: -t*
96+
*Default: .png* --- *Supported Types: png, jpg, webp, bmp, psd, tiff, tga* --- *Console Parameter Name: -t*
9797

9898
### Rough Output Height
9999
Here you set the size that you want most output panels to roughly be, the program will uses it as a guide to see where to slice/cut the images, however it IS ROUGH, meaning if the program finds bubbles/sfx/whatever at that specific pixel length, it will try to find the next closest position where it can cut the image. Thus the output size of each image will vary because of that, but they all will be roughly around this size.
@@ -135,7 +135,7 @@ This is the step at which the program moves if it find the line it's on to be un
135135

136136
*Default: 5* --- *Value Range: 1-100* --- *Console Parameter Name: -sl*
137137

138-
### Ignorable Horizental Margins Pixels
138+
### Ignorable Horizental Margins Pixels
139139
This gives the option to ignore pixels on the border of the image when checking for bubbles/sfw/whatever. Why you might ask, Borders do not make the detection algorithm happy, so in some cases you want it to start its detection only inside said border, be careful to what value you want it to be since if it's larger that image it will case the program to crash/stop its operation.
140140

141141
*Default: 0* --- *Console Parameter Name: -ip*
@@ -174,22 +174,22 @@ Of course you can use whatever version of waifu2x or process that you want, this
174174

175175
### Console Version Usage
176176
```
177-
python SmartStitchConsole.py [-h] -i INPUT_FOLDER
178-
-sh SPLIT_HEIGHT
179-
[-t {.png,.jpg,.webp,.bmp,.tiff,.tga}]
180-
[-cw CUSTOM_WIDTH]
181-
[-dt {none,pixel}]
182-
[-s [0-100]]
183-
[-lq [1-100]]
184-
[-ip IGNORABLE_PIXELS]
177+
python SmartStitchConsole.py [-h] -i INPUT_FOLDER
178+
-sh SPLIT_HEIGHT
179+
[-t {.png,.jpg,.webp,.bmp,.psd,.tiff,.tga}]
180+
[-cw CUSTOM_WIDTH]
181+
[-dt {none,pixel}]
182+
[-s [0-100]]
183+
[-lq [1-100]]
184+
[-ip IGNORABLE_PIXELS]
185185
[-sl [1-100]]
186186
required arguments:
187187
--input_folder INPUT_FOLDER, -i INPUT_FOLDER Sets the path of Input Folder
188188
optional arguments:
189189
-h, --help show this help message and exit
190190
-i INPUT_FOLDER Sets the path of Input Folder
191191
-sh SPLIT_HEIGHT Sets the value of the Rough Panel Height
192-
-t {.png,.jpg,.webp,.bmp,.tiff,.tga}
192+
-t {.png,.jpg,.webp,.bmp,.psd,.tiff,.tga}
193193
Sets the type/format of the Output Image Files
194194
-cw CUSTOM_WIDTH [Advanced] Forces Fixed Width for All Output Image Files, Default=None (Disabled)
195195
-dt {none,pixel} [Advanced] Sets the type of Slice Location Detection, Default=pixel (Pixel Comparison)
@@ -202,7 +202,7 @@ optional arguments:
202202
### Console Version Command Example
203203
```
204204
python SmartStitchConsole.py -i "Review me" -sh 7500 -t ".png"
205-
# This will Run the application on for input_folder of "./Review me" with split_height of 7500 and output_tyoe of ".png"
205+
# This will Run the application on for input_folder of "./Review me" with split_height of 7500 and output_type of ".png"
206206
```
207207

208208
## How to build/compile your own GUI Version?

console/launcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def launch():
1515
parser.add_argument(
1616
"-sh",
1717
dest='split_height',
18-
type=postive_int,
18+
type=positive_int,
1919
required=True,
2020
help='Sets the value of the Rough Panel Height',
2121
)
@@ -24,13 +24,13 @@ def launch():
2424
dest='output_type',
2525
type=str,
2626
default=".png",
27-
choices=['.png', '.jpg', '.webp', '.bmp', '.tiff', '.tga'],
27+
choices=['.png', '.jpg', '.webp', '.bmp', '.tiff', '.tga', '.psd'],
2828
help='Sets the type/format of the Output Image Files',
2929
)
3030
parser.add_argument(
3131
"-cw",
3232
dest='custom_width',
33-
type=postive_int,
33+
type=positive_int,
3434
default=-1,
3535
help='[Advanced] Forces Fixed Width for All Output Image Files, Default=None (Disabled)',
3636
)
@@ -63,7 +63,7 @@ def launch():
6363
parser.add_argument(
6464
"-ip",
6565
dest='ignorable_pixels',
66-
type=postive_int,
66+
type=positive_int,
6767
default=5,
6868
help='[Advanced] Sets the value of Ignorable Border Pixels, Default=5 (5px)',
6969
)
@@ -81,7 +81,7 @@ def launch():
8181
process.run(kwargs)
8282

8383

84-
def postive_int(value):
84+
def positive_int(value):
8585
ivalue = int(value)
8686
if ivalue <= 0:
8787
raise argparse.ArgumentTypeError("%s is an invalid positive int value" % value)

core/detectors/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .direct_slicing import DirectSlicingDetector
2-
from .pixel_comparsion import PixelComparsionDetector
2+
from .pixel_comparison import PixelComparisonDetector
33
from .selector import select_detector
44

5-
__all__ = [DirectSlicingDetector, PixelComparsionDetector, select_detector]
5+
__all__ = [DirectSlicingDetector, PixelComparisonDetector, select_detector]

core/detectors/pixel_comparsion.py renamed to core/detectors/pixel_comparison.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from core.services.global_logger import logFunc
55

66

7-
class PixelComparsionDetector:
7+
class PixelComparisonDetector:
88
@logFunc(inclass=True)
99
def run(self, combined_img: pil.Image, split_height: int, **kwargs) -> list[int]:
1010
"""Uses Neighbouring pixels comparison to detect ideal slice locations"""
1111
# Changes from a pil Image to an numpy pixel array
1212
combined_img = np.array(combined_img.convert('L'))
13-
# Setting up rest of Detector Paramaters
13+
# Setting up rest of Detector Parameters
1414
scan_step = kwargs.get('scan_step', 5)
1515
ignorable_pixels = kwargs.get('ignorable_pixels', 0)
1616
sensitivity = kwargs.get('sensitivity', 90)

core/detectors/selector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from ..services import logFunc
44
from .direct_slicing import DirectSlicingDetector
5-
from .pixel_comparsion import PixelComparsionDetector
5+
from .pixel_comparison import PixelComparisonDetector
66

77

88
@logFunc()
@@ -11,8 +11,8 @@ def select_detector(detection_type: str | DETECTION_TYPE):
1111
return DirectSlicingDetector()
1212
elif (
1313
detection_type == "pixel"
14-
or detection_type == DETECTION_TYPE.PIXEL_COMPARSION.value
14+
or detection_type == DETECTION_TYPE.PIXEL_COMPARISON.value
1515
):
16-
return PixelComparsionDetector()
16+
return PixelComparisonDetector()
1717
else:
1818
raise Exception("Invalid Detection Type")

core/models/app_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def __init__(self, json_dict: dict[str, any] = None):
99
self.split_height: int = 5000
1010
self.output_type: str = '.png'
1111
self.lossy_quality: str = 100
12-
self.detector_type: DETECTION_TYPE = DETECTION_TYPE.PIXEL_COMPARSION
12+
self.detector_type: DETECTION_TYPE = DETECTION_TYPE.PIXEL_COMPARISON
1313
self.senstivity: int = 90
1414
self.ignorable_pixels: int = 5
1515
self.scan_step: int = 5

core/services/directory_explorer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from natsort import natsorted
44

55
from ..models import WorkDirectory
6-
from ..utils.constants import OUTPUT_SUFFIX, POSTPROCESS_SUFFIX, SUPPORTTED_IMG_TYPES
6+
from ..utils.constants import OUTPUT_SUFFIX, POSTPROCESS_SUFFIX, SUPPORTED_IMG_TYPES
77
from ..utils.errors import DirectoryException
88
from .global_logger import logFunc
99

@@ -33,7 +33,7 @@ def explore_directories(self, main_directory: WorkDirectory) -> list[WorkDirecto
3333
):
3434
img_files = []
3535
for file in files:
36-
if file.lower().endswith(SUPPORTTED_IMG_TYPES):
36+
if file.lower().endswith(SUPPORTED_IMG_TYPES):
3737
img_files.append(file)
3838
img_files = natsorted(img_files)
3939
if img_files:

core/services/global_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class GlobalLogger:
1010
@classmethod
1111
def configureGlobalLogger(self):
12-
"""Initalizes and Configures Logging Service"""
12+
"""Initializes and Configures Logging Service"""
1313
if not os.path.exists(LOG_REL_DIR):
1414
os.makedirs(LOG_REL_DIR)
1515
current_date = datetime.now()
@@ -19,7 +19,7 @@ def configureGlobalLogger(self):
1919
log_level = logging.DEBUG
2020
log_format = '%(levelname)s:%(asctime)s:%(message)s'
2121
logging.basicConfig(format=log_format, filename=log_filename, level=log_level)
22-
logging.debug('GlobalLogger:Logger Initalized')
22+
logging.debug('GlobalLogger:Logger Initialized')
2323
# Removes the pil logging from polluting the Debug Level.
2424
pil_logger = logging.getLogger('PIL')
2525
pil_logger.setLevel(logging.INFO)

0 commit comments

Comments
 (0)