fix: RGB to BGR
Browse files
image_processing_tagger.py
CHANGED
@@ -118,6 +118,14 @@ def resize_with_padding(
|
|
118 |
|
119 |
new_image = new_image.convert("RGB")
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
if return_numpy:
|
122 |
new_image = np.array(new_image)
|
123 |
# If the input image channel dimension was of size 1, then it is dropped when converting to a PIL image
|
|
|
118 |
|
119 |
new_image = new_image.convert("RGB")
|
120 |
|
121 |
+
# Convert to numpy array
|
122 |
+
image_array = np.asarray(new_image, dtype=np.float32)
|
123 |
+
|
124 |
+
# Convert PIL-native RGB to BGR
|
125 |
+
image_array = image_array[:, :, ::-1]
|
126 |
+
|
127 |
+
new_image = Image.fromarray(image_array.astype(np.uint8))
|
128 |
+
|
129 |
if return_numpy:
|
130 |
new_image = np.array(new_image)
|
131 |
# If the input image channel dimension was of size 1, then it is dropped when converting to a PIL image
|