Skip to content

Commit

Permalink
ensure the scale parameter will be used to calculate integer position…
Browse files Browse the repository at this point in the history
…s for words
  • Loading branch information
boidolr committed Jan 26, 2016
1 parent 89508af commit 0b0e880
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wordcloud/wordcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,14 @@ def to_image(self):
else:
height, width = self.height, self.width

img = Image.new(self.mode, (width * self.scale, height * self.scale),
img = Image.new(self.mode, (int(width * self.scale), int(height * self.scale)),
self.background_color)
draw = ImageDraw.Draw(img)
for (word, count), font_size, position, orientation, color in self.layout_:
font = ImageFont.truetype(self.font_path, font_size * self.scale)
font = ImageFont.truetype(self.font_path, int(font_size * self.scale))
transposed_font = ImageFont.TransposedFont(font,
orientation=orientation)
pos = (position[1] * self.scale, position[0] * self.scale)
pos = (int(position[1] * self.scale), int(position[0] * self.scale))
draw.text(pos, word, fill=color, font=transposed_font)
return img

Expand Down

0 comments on commit 0b0e880

Please sign in to comment.