Commit ea578eb1 authored by Andreas Mueller's avatar Andreas Mueller

remove scipy dependency for image reading

parent a5341953
......@@ -5,8 +5,9 @@ Using custom colors
Using the recolor method and custom coloring functions.
"""
import numpy as np
import Image
from os import path
from scipy.misc import imread
import matplotlib.pyplot as plt
import random
......@@ -21,7 +22,7 @@ d = path.dirname(__file__)
# read the mask image
# taken from
# http://www.stencilry.org/stencils/movies/star%20wars/storm-trooper.gif
mask = imread(path.join(d, "stormtrooper_mask.png"))
mask = np.array(Image.open(path.join(d, "stormtrooper_mask.png")))
# movie script of "a new hope"
# http://www.imsdb.com/scripts/Star-Wars-A-New-Hope.html
......
examples/alice.png

139 KB | W: | H:

examples/alice.png

159 KB | W: | H:

examples/alice.png
examples/alice.png
examples/alice.png
examples/alice.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -11,7 +11,8 @@ but make sure the image shapes line up.
"""
from os import path
from scipy.misc import imread
import Image
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
......@@ -23,7 +24,7 @@ text = open(path.join(d, 'alice.txt')).read()
# read the mask / color image
# taken from http://jirkavinse.deviantart.com/art/quot-Real-Life-quot-Alice-282261010
alice_coloring = imread(path.join(d, "alice_color.png"))
alice_coloring = np.array(Image.open(path.join(d, "alice_color.png")))
wc = WordCloud(background_color="white", max_words=2000, mask=alice_coloring,
stopwords=STOPWORDS.add("said"),
......
......@@ -6,7 +6,8 @@ Using a mask you can generate wordclouds in arbitrary shapes.
"""
from os import path
from scipy.misc import imread
import Image
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS
......@@ -19,7 +20,7 @@ text = open(path.join(d, 'alice.txt')).read()
# read the mask image
# taken from
# http://www.stencilry.org/stencils/movies/alice%20in%20wonderland/255fk.jpg
alice_mask = imread(path.join(d, "alice_mask.png"))
alice_mask = np.array(Image.open(path.join(d, "alice_mask.png")))
wc = WordCloud(background_color="white", max_words=2000, mask=alice_mask,
stopwords=STOPWORDS.add("said"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment