Skip to content

Commit

Permalink
FIX web_demo upload was not processing grayscale correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyk committed Aug 26, 2014
1 parent 5a0ad46 commit 9516115
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/web_demo/exifutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ def open_oriented_im(im_path):
if exif is not None and 274 in exif:
orientation = exif[274]
im = apply_orientation(im, orientation)
return np.asarray(im).astype(np.float32) / 255.
img = np.asarray(im).astype(np.float32) / 255.
if img.ndim == 2:
img = img[:, :, np.newaxis]
img = np.tile(img, (1, 1, 3))
elif img.shape[2] == 4:
img = img[:, :, :3]
return img


def apply_orientation(im, orientation):
Expand Down

0 comments on commit 9516115

Please sign in to comment.