Vela commited on
Commit
50a42c6
·
1 Parent(s): 4d9c27e

updated resize function

Browse files
app.py CHANGED
@@ -13,7 +13,7 @@ if uploaded_file:
13
  st.image(image, caption="Uploaded Image", width=500)
14
 
15
  file_path = image_conversion.get_file_path(uploaded_file)
16
- selected_option = st.selectbox("Choose the following",["","Rotate","Change to RGB", "Change to BGR", "Change to Grayscale","Increase Brightness","Blur Image"])
17
  option = selected_option.replace(" ","_").lower()
18
  image_conversion.display_converted_image(st, option, file_path)
19
 
 
13
  st.image(image, caption="Uploaded Image", width=500)
14
 
15
  file_path = image_conversion.get_file_path(uploaded_file)
16
+ selected_option = st.selectbox("Choose the following",["","Rotate","Change to RGB", "Change to BGR", "Change to Grayscale","Increase Brightness","Blur Image", "Resize Image"])
17
  option = selected_option.replace(" ","_").lower()
18
  image_conversion.display_converted_image(st, option, file_path)
19
 
src/app/image_conversion.py CHANGED
@@ -33,4 +33,6 @@ def display_converted_image(st, option, file_path):
33
  elif option == "blur_image":
34
  file = home_page.change_image_color_format(file_path,"Blur_Image")
35
  st.image(file, width=500)
36
-
 
 
 
33
  elif option == "blur_image":
34
  file = home_page.change_image_color_format(file_path,"Blur_Image")
35
  st.image(file, width=500)
36
+ elif option == "resize_image":
37
+ file=home_page.change_image_color_format(file_path,"resize_image")
38
+ st.image(file, width=500)
src/modules/home_page.py CHANGED
@@ -23,6 +23,9 @@ def change_image_color_format(file_path, format_type, angle=0,factor=1.5):
23
  elif format_type.lower() == "blur_image":
24
  imgBlur = cv2.GaussianBlur(img,(7,7),0)
25
  return imgBlur
 
 
 
26
 
27
 
28
  # Function to rotate an OpenCV image (numpy.ndarray)
@@ -46,4 +49,8 @@ def increase_brightness(image, factor=1.2):
46
  brightened_image = np.clip(brightened_image, 0, 255).astype(np.uint8)
47
 
48
  return brightened_image
 
 
 
 
49
 
 
23
  elif format_type.lower() == "blur_image":
24
  imgBlur = cv2.GaussianBlur(img,(7,7),0)
25
  return imgBlur
26
+ elif format_type.lower() == "resize_image":
27
+ resized_image = resize_image(img,width=1000,height=1000)
28
+ return resized_image
29
 
30
 
31
  # Function to rotate an OpenCV image (numpy.ndarray)
 
49
  brightened_image = np.clip(brightened_image, 0, 255).astype(np.uint8)
50
 
51
  return brightened_image
52
+
53
+ def resize_image(img,width = 200,height = 200):
54
+ imgResize = cv2.resize(img,(width,height))
55
+ return imgResize
56