Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
fixed issue with process not completing with 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
code2k13 committed Oct 8, 2021
1 parent a703458 commit 2ad2d8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions removestars.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,25 @@ def process_channel(channel,pad_width,input_image_size):
total_steps = (max_dimension/1024)**2
step_size = int((1/total_steps)*100)
progress_bar = tqdm(total=100)
progress_bar.update(step_size)
output = process_channel(input_image,pad_width,input_image.size)
output = output.crop((0,0,size[0],size[1]))
output.save(args[2])

progress_bar.update(step_size)
elif mode == 'RGB' or mode == 'RGBA':
total_steps = 3*(max_dimension/1024)**2
step_size = int((1/total_steps)*100)
progress_bar = tqdm(total=100)
progress_bar.update(step_size)
channels = Image.Image.split(input_image)
all_outputs = []
for channel in channels[0:3]:
channel_output = process_channel(channel,pad_width,input_image.size)
channel_output = channel_output.crop((0,0,size[0],size[1]))
all_outputs.append(channel_output)
output =Image.merge('RGB', (all_outputs[0],all_outputs[1],all_outputs[2]))
output.save(args[2])
output.save(args[2])
progress_bar.update(step_size)
else:
print("Invalid mode for input image:", mode)
print("Only grayscale(L) and RGB(RGBA) images are supported.")

0 comments on commit 2ad2d8f

Please sign in to comment.