Skip to content

Commit

Permalink
Merge pull request #359 from roboflow/bugfix/skip-jpeg-encode-in-sdk-…
Browse files Browse the repository at this point in the history
…if-no-resize

Skip encode image as jpeg if no-resize is specified
  • Loading branch information
PacificDou authored Apr 18, 2024
2 parents 76a1d56 + c5883c7 commit f78f5a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inference/core/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.9.21rc3"
__version__ = "0.9.22"


if __name__ == "__main__":
Expand Down
5 changes: 5 additions & 0 deletions inference_sdk/http/utils/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ def load_image_from_string(
url=reference, max_height=max_height, max_width=max_width
)
if os.path.exists(reference):
if max_height is None or max_width is None:
with open(reference, "rb") as f:
img_bytes = f.read()
img_base64_str = encode_base_64(payload=img_bytes)
return img_base64_str, None
local_image = cv2.imread(reference)
if local_image is None:
raise EncodingError(f"Could not load image from {reference}")
Expand Down

0 comments on commit f78f5a2

Please sign in to comment.