diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-07-14 16:18:21 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-07-14 16:18:21 +0100 |
commit | 043d54652fc529504a61fdb46c5cc1992763721d (patch) | |
tree | 86eab2653896c95910dbdeb51aa4d4f7ae9bef53 | |
parent | 95c26349d6b2f34214e6b069cb6328705b87133c (diff) | |
download | sspreview-043d54652fc529504a61fdb46c5cc1992763721d.tar.gz sspreview-043d54652fc529504a61fdb46c5cc1992763721d.zip |
x,y scale and docs
-rw-r--r-- | README.md | 5 | ||||
-rwxr-xr-x | sspreview | 11 |
2 files changed, 14 insertions, 2 deletions
@@ -20,6 +20,11 @@ sspreview spritesheet.png <img src="https://git.usebox.net/sspreview/plain/example.png" alt="Example" style="width:auto;"> +Tips: + +* in "scale", provide two numbers separated with a comma in case you want a different scale factor for x and y (e.g. `20,10`) +* if your spritesheet changes, press `Update` and it will reload the image + Caveats: * my first tinker app @@ -132,7 +132,14 @@ class Preview(object): self.error("Invalid height") try: - scale = int(self.scale.get()) + scale = self.scale.get() + if "," in scale: + scale = scale.split(",") + if len(scale) != 2: + self.error("Invalid x,y scale factor") + else: + scale = (scale, scale) + scale = [int(x) for x in scale] except Exception: self.error("Invalid scale") @@ -158,7 +165,7 @@ class Preview(object): for x in range(0, w, width): frames.append( image.crop((x, y, x + width, y + height)).resize( - (width * scale, height * scale), None + (width * scale[0], height * scale[1]), None ) ) |