Skip to content

Commit

Permalink
Fix #42, non alpha loaded images
Browse files Browse the repository at this point in the history
  • Loading branch information
thoppe committed Jun 11, 2019
1 parent 63430b5 commit 7d1f99d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pixelhouse/_version.py
@@ -1,6 +1,7 @@
__version__ = "0.5.3"
__version__ = "0.5.4"

"""
Version: 0.5.4: Loaded images are now fully opaque
Version: 0.5.3: Show and resize now return self for chaining
Version: 0.5.2: Add canvas init from image and setters from scalars
Version: 0.5.1: Add canvas.rgb getter/setter to quickly get non-alpha img
Expand Down
4 changes: 2 additions & 2 deletions pixelhouse/canvas.py
Expand Up @@ -439,9 +439,9 @@ def load(self, filename):
# Read the image in and convert to RGB space
img = cv2.imread(filename, cv2.IMREAD_UNCHANGED)

# If needed, add in an alpha channel
# If needed, add in an alpha channel as fully opaque
if img.shape[2] == 3:
alpha = np.zeros_like(img[:, :, 0])
alpha = 255*np.ones_like(img[:, :, 0])
img = np.dstack((img, alpha))

self.img = cv2.cvtColor(img, cv2.COLOR_BGRA2RGBA)
Expand Down

0 comments on commit 7d1f99d

Please sign in to comment.