From d0f50411eaf875e82060948e90edf843a4bbd68a Mon Sep 17 00:00:00 2001 From: ultraflame42 <34125174+ultraflame4@users.noreply.github.com> Date: Sun, 18 Dec 2022 20:45:22 +0800 Subject: [PATCH] Renamed project --- README.md | 6 +++--- {TiledImage => TilImg}/__init__.py | 4 ++-- {TiledImage => TilImg}/__main__.py | 20 ++++++++++---------- {TiledImage => TilImg}/errors.py | 0 {TiledImage => TilImg}/utils.py | 2 +- {TiledImage => TilImg}/video.py | 16 ++++++++-------- setup.cfg | 2 +- test.py | 8 ++++---- test_video.py | 12 ++++++------ 9 files changed, 35 insertions(+), 35 deletions(-) rename {TiledImage => TilImg}/__init__.py (98%) rename {TiledImage => TilImg}/__main__.py (77%) rename {TiledImage => TilImg}/errors.py (100%) rename {TiledImage => TilImg}/utils.py (99%) rename {TiledImage => TilImg}/video.py (91%) diff --git a/README.md b/README.md index 5966744..3e064ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TiledImage V3 +# TilImg V3 This program composites many images into one big image using a set of images and a reference image ![results](https://user-images.githubusercontent.com/34125174/208235487-44f5e641-e6eb-453a-a9db-25d93a093782.png) [Generated from Photo by Pixabay from Pexels: https://www.pexels.com/photo/dock-under-cloudy-sky-in-front-of-mountain-206359/ ) @@ -19,7 +19,7 @@ Usage (Before v3.1.0): `timg REFERENCE_IMAGEPATH OUT_PATH` ##### Optional Arguments - --resize-factor: The factor by which to resize the reference image. Default is -1 (auto, resizes based on tile size. Final image resolution will stay mostly the same) -- --process-type: TiledImage uses numba to speed up computation. This argument specifies the method used to do so. Default is guvectorize +- --process-type: TilImg uses numba to speed up computation. This argument specifies the method used to do so. Default is guvectorize - guvectorize: Uses numba's guvectorize to speed up computation. This is the default method - njit: Uses numba's njit to speed up computation. This is known to be extremely slow - cuda: Also uses numba's guvectorize but targets CUDA-enabled GPUs. This is known to be slighly faster than guvectorize but requires a CUDA-enabled GPU AND has some overhead costs @@ -39,7 +39,7 @@ Usage: `timg vid [OPTIONS] SOURCE_PATH SAVE_PATH TILESET_PATHS...` ##### Optional Arguments - --resize-factor: The factor by which to resize the reference image. Default is -1 (auto, resizes based on tile size. Final image resolution will stay mostly the same) -- --process-type: TiledImage uses numba to speed up computation. This argument specifies the method used to do so. Default is guvectorize +- --process-type: TilImg uses numba to speed up computation. This argument specifies the method used to do so. Default is guvectorize - guvectorize: Uses numba's guvectorize to speed up computation. This is the default method - ~~njit: Uses numba's njit to speed up computation. This is known to be extremely slow~~ Not available in video mode - cuda: Also uses numba's guvectorize but targets CUDA-enabled GPUs. This is known to be slighly faster than guvectorize but requires a CUDA-enabled GPU AND has some overhead costs diff --git a/TiledImage/__init__.py b/TilImg/__init__.py similarity index 98% rename from TiledImage/__init__.py rename to TilImg/__init__.py index 732763a..defcf7e 100644 --- a/TiledImage/__init__.py +++ b/TilImg/__init__.py @@ -4,8 +4,8 @@ import numba as nb from rich.progress import Progress, SpinnerColumn, TextColumn -from TiledImage.errors import UnexpectedImageShapeError -from TiledImage.utils import ClockTimer, SpinnerProgress +from TilImg.errors import UnexpectedImageShapeError +from TilImg.utils import ClockTimer, SpinnerProgress nb.warnings.simplefilter('ignore', category=nb.NumbaDeprecationWarning) diff --git a/TiledImage/__main__.py b/TilImg/__main__.py similarity index 77% rename from TiledImage/__main__.py rename to TilImg/__main__.py index 437d39c..589867a 100644 --- a/TiledImage/__main__.py +++ b/TilImg/__main__.py @@ -8,9 +8,9 @@ from rich.progress import Progress, BarColumn, TextColumn, SpinnerColumn from rich.table import Table -import TiledImage -from TiledImage import video -from TiledImage.utils import ProcessType +import TilImg +from TilImg import video +from TilImg.utils import ProcessType @@ -24,12 +24,12 @@ def tiledImage_cli( ): os.makedirs("./build/", exist_ok=True) - overall_progress = TiledImage.utils.getProgressBar() + overall_progress = TilImg.utils.getProgressBar() overall_task = overall_progress.add_task("Overall Progress", total=5) with overall_progress: - tiles, tile_shape = TiledImage.utils.load_imageset(Path(), "", tileset_paths, progress=overall_progress) + tiles, tile_shape = TilImg.utils.load_imageset(Path(), "", tileset_paths, progress=overall_progress) overall_progress.advance(overall_task) if resize_factor < 0: @@ -39,18 +39,18 @@ def tiledImage_cli( typer.echo(f"Invalid resize_factor: {resize_factor}") return - referenceImage = TiledImage.utils.load_image(reference_imagepath, resize=resize_factor, progress=overall_progress) + referenceImage = TilImg.utils.load_image(reference_imagepath, resize=resize_factor, progress=overall_progress) overall_progress.advance(overall_task) if process_type == ProcessType.njit: overall_progress.print("Warning!!!. Using njit process type!!!!! This is EXTREMELY SLOW and should only be used for testing !!!") - image = TiledImage.generate_tiledimage(referenceImage, tiles, tile_shape) + image = TilImg.generate_tiledimage(referenceImage, tiles, tile_shape) elif process_type == ProcessType.cuda: overall_progress.print("Using cuda process type!!!!! This only works on CUDA enabled GPUS !!!") - image = TiledImage.generate_tiledimage_gu(referenceImage, tiles, tile_shape, useCuda=True,progress=overall_progress) + image = TilImg.generate_tiledimage_gu(referenceImage, tiles, tile_shape, useCuda=True, progress=overall_progress) else: overall_progress.print("Using default process type guvectorize...") - image = TiledImage.generate_tiledimage_gu(referenceImage, tiles, tile_shape, useCuda=False,progress=overall_progress) + image = TilImg.generate_tiledimage_gu(referenceImage, tiles, tile_shape, useCuda=False, progress=overall_progress) overall_progress.advance(overall_task) @@ -64,7 +64,7 @@ def tiledImage_cli( def main(): app = typer.Typer() vidTyper = typer.Typer() - print("# TiledImage version:", TiledImage.__version__) + print("# TilImg version:", TilImg.__version__) app.command(name="img",help="Generates a tiled image using a reference image and a set of images as tiles")(tiledImage_cli) app.command(name="vid",help="Generates a tiled image video by converting all of its frames into a tiled image.")(video.video_cli) diff --git a/TiledImage/errors.py b/TilImg/errors.py similarity index 100% rename from TiledImage/errors.py rename to TilImg/errors.py diff --git a/TiledImage/utils.py b/TilImg/utils.py similarity index 99% rename from TiledImage/utils.py rename to TilImg/utils.py index 1df6da6..bdffd89 100644 --- a/TiledImage/utils.py +++ b/TilImg/utils.py @@ -11,7 +11,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn, TimeRemainingColumn, BarColumn, MofNCompleteColumn, \ TimeElapsedColumn -from TiledImage import UnexpectedImageShapeError +from TilImg import UnexpectedImageShapeError class ClockTimer: diff --git a/TiledImage/video.py b/TilImg/video.py similarity index 91% rename from TiledImage/video.py rename to TilImg/video.py index f0f2d4f..46c3144 100644 --- a/TiledImage/video.py +++ b/TilImg/video.py @@ -8,7 +8,7 @@ SpinnerColumn from rich.table import Table -import TiledImage +import TilImg import colorama import numpy import numpy as np @@ -18,8 +18,8 @@ import typer from PIL import Image -from TiledImage import ClockTimer, generate_tiledimage_gu, utils -from TiledImage.utils import ProcessType +from TilImg import ClockTimer, generate_tiledimage_gu, utils +from TilImg.utils import ProcessType class Video: @@ -127,7 +127,7 @@ def video_cli( process_type: ProcessType = typer.Option(ProcessType.guvectorize, help="Type of processing to use. Default: guvectorize. njit IS not available for video") ): - overall_progress = TiledImage.utils.getProgressBar() + overall_progress = TilImg.utils.getProgressBar() overall_progress_task = overall_progress.add_task(f"Overall Progress", total=4) @@ -140,11 +140,11 @@ def video_cli( with overall_progress: useCuda = process_type == ProcessType.cuda - tiles, tile_shape = TiledImage.utils.load_imageset(Path(), "", tileset_paths, progress=overall_progress) + tiles, tile_shape = TilImg.utils.load_imageset(Path(), "", tileset_paths, progress=overall_progress) overall_progress.advance(overall_progress_task, 1) - video = TiledImage.video.Video(source_path) - TiledImage.video.generate_tiledimage_video(video, tiles, tile_shape, useCuda=useCuda, - resize_factor=resize_factor, progress=overall_progress) + video = TilImg.video.Video(source_path) + TilImg.video.generate_tiledimage_video(video, tiles, tile_shape, useCuda=useCuda, + resize_factor=resize_factor, progress=overall_progress) overall_progress.advance(overall_progress_task, 1) utils.test_for_ffmpeg() overall_progress.update(overall_progress_task, description="Overall Progress - waiting for ffmpeg...",advance=1) diff --git a/setup.cfg b/setup.cfg index 26c31f8..8e8f983 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = TiledImage +name = TilImg version = attr: TiledImage.__version__ author = ultraflame42 author_email = ultraflame4@gmail.com diff --git a/test.py b/test.py index 1737289..11c6276 100644 --- a/test.py +++ b/test.py @@ -1,16 +1,16 @@ import os from pathlib import Path from PIL import Image -import TiledImage as tm -import TiledImage.utils +import TilImg as tm +import TilImg.utils os.makedirs("./build/",exist_ok=True) -tiles,tile_shape = TiledImage.utils.load_imageset(Path(), "./assets/tiles/*.png") +tiles,tile_shape = TilImg.utils.load_imageset(Path(), "./assets/tiles/*.png") # atlas = tm.create_tiles_atlas(tiles,tile_shape) # Image.fromarray(atlas).save("./build/atlas.png") -referenceImage = TiledImage.utils.load_image(Path("./assets/blackhole1.jpg"), resize=1 / max(tile_shape), silent=False) +referenceImage = TilImg.utils.load_image(Path("./assets/blackhole1.jpg"), resize=1 / max(tile_shape), silent=False) # referenceImage = tm.load_image(Path("./assets/blackhole1.jpg"),silent=False) diff --git a/test_video.py b/test_video.py index b72eff7..6df2d9c 100644 --- a/test_video.py +++ b/test_video.py @@ -2,10 +2,10 @@ import cv2 -import TiledImage.video -import TiledImage +import TilImg.video +import TilImg -print(TiledImage.__version__) -tiles,tile_shape = TiledImage.utils.load_imageset(Path(), "./assets/tiles/*.png") -video = TiledImage.video.Video(Path("./assets/ref_vid.mp4")) -TiledImage.video.generate_tiledimage_video(video, tiles, tile_shape,useCuda=True) \ No newline at end of file +print(TilImg.__version__) +tiles,tile_shape = TilImg.utils.load_imageset(Path(), "./assets/tiles/*.png") +video = TilImg.video.Video(Path("./assets/ref_vid.mp4")) +TilImg.video.generate_tiledimage_video(video, tiles, tile_shape, useCuda=True) \ No newline at end of file