MCPcopy Index your code
hub / github.com/TensorPy/TensorPy / convert_image_file_to_jpg

Function convert_image_file_to_jpg

tensorpy/image_base.py:22–32  ·  view source on GitHub ↗

Converts a locally-stored image file to a proper JPEG image file.

(file_name)

Source from the content-addressed store, hash-verified

20
21
22def convert_image_file_to_jpg(file_name):
23 """ Converts a locally-stored image file to a proper JPEG image file. """
24 infile = file_name
25 f, e = os.path.splitext(infile)
26 outfile = f + ".jpg"
27 if infile != outfile:
28 try:
29 with Image.open(infile) as image:
30 image.convert('RGB').save(outfile, "JPEG")
31 except IOError:
32 raise Exception("Cannot convert %s to jpg!" % file_name)
33
34
35def load_image_from_url(image_url):

Callers 2

classify_image_urlFunction · 0.85
classify_local_imageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected