Skip to content

Commit

Permalink
Renamed project
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraflame4 committed Dec 18, 2022
1 parent 5d3ab8d commit d0f5041
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/ )
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions TiledImage/__init__.py → TilImg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
20 changes: 10 additions & 10 deletions TiledImage/__main__.py → TilImg/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand All @@ -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:
Expand All @@ -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)


Expand All @@ -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)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion TiledImage/utils.py → TilImg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions TiledImage/video.py → TilImg/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SpinnerColumn
from rich.table import Table

import TiledImage
import TilImg
import colorama
import numpy
import numpy as np
Expand All @@ -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:
Expand Down Expand Up @@ -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)


Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = TiledImage
name = TilImg
version = attr: TiledImage.__version__
author = ultraflame42
author_email = [email protected]
Expand Down
8 changes: 4 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
12 changes: 6 additions & 6 deletions test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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)

0 comments on commit d0f5041

Please sign in to comment.