Skip to content

Commit

Permalink
engine: accept 'transparent' as value for color
Browse files Browse the repository at this point in the history
Even if it's not supported yet. Referencing thumbor/thumbor#419
  • Loading branch information
scorphus committed Apr 12, 2015
1 parent 12d90a9 commit 6fa2b3a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions opencv_engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ def parse_hex_color(cls, color):
return None

def gen_image(self, size, color_value):
color = self.parse_hex_color(color_value)
if not color:
raise ValueError('Color %s is not valid.' % color_value)
img0 = cv.CreateImage(size, self.image_depth, self.image_channels)
if color_value == 'transparent':
color = (255, 255, 255, 255)
else:
color = self.parse_hex_color(color_value)
if not color:
raise ValueError('Color %s is not valid.' % color_value)
cv.Set(img0, color)
return img0

Expand Down

0 comments on commit 6fa2b3a

Please sign in to comment.