muhammadsalmanalfaridzi commited on
Commit
3a90bd9
β€’
1 Parent(s): 22b1679

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -89,6 +89,7 @@ def get_bounding_box_with_threshold(image, threshold):
89
  return (left, top, right, bottom)
90
  else:
91
  return None
 
92
  def position_logic(image_path, canvas_size, padding_top, padding_right, padding_bottom, padding_left, use_threshold=True):
93
  """Position and resize an image based on cropping and padding requirements."""
94
  image = Image.open(image_path).convert("RGBA")
@@ -173,10 +174,6 @@ def position_logic(image_path, canvas_size, padding_top, padding_right, padding_
173
 
174
  return log, image, x, y
175
 
176
- import os
177
- from PIL import Image, ImageDraw
178
- import logging
179
-
180
  # Constants for canvas sizes and paddings
181
  CANVAS_SIZES = {
182
  'Rox': ((1080, 1080), (112, 125, 116, 125)),
@@ -258,14 +255,6 @@ def process_single_image(image_path, output_folder, bg_method, canvas_size_name,
258
  logging.error(f"Error processing {filename}: {e}")
259
  return None, None
260
 
261
- import os
262
- import time
263
- import shutil
264
- import zipfile
265
- import json
266
- import logging
267
- from concurrent.futures import ThreadPoolExecutor
268
-
269
  # Set up logging
270
  logging.basicConfig(level=logging.INFO)
271
 
 
89
  return (left, top, right, bottom)
90
  else:
91
  return None
92
+
93
  def position_logic(image_path, canvas_size, padding_top, padding_right, padding_bottom, padding_left, use_threshold=True):
94
  """Position and resize an image based on cropping and padding requirements."""
95
  image = Image.open(image_path).convert("RGBA")
 
174
 
175
  return log, image, x, y
176
 
 
 
 
 
177
  # Constants for canvas sizes and paddings
178
  CANVAS_SIZES = {
179
  'Rox': ((1080, 1080), (112, 125, 116, 125)),
 
255
  logging.error(f"Error processing {filename}: {e}")
256
  return None, None
257
 
 
 
 
 
 
 
 
 
258
  # Set up logging
259
  logging.basicConfig(level=logging.INFO)
260