You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static void gen() throws IOException {
final FrequencyAnalyzer frequencyAnalyzer = new FrequencyAnalyzer();
frequencyAnalyzer.setWordFrequenciesToReturn(70);
frequencyAnalyzer.setMinWordLength(3);
File f = new File("F:/temp/text.txt");
final List wordFrequencies = frequencyAnalyzer.load(new FileInputStream(f));
final Dimension dimension = new Dimension(500, 312);
final WordCloud wordCloud = new WordCloud(dimension, CollisionMode.PIXEL_PERFECT);
wordCloud.setPadding(2);
wordCloud.setBackground(new PixelBoundryBackground("F:/temp/whale.jpg"));
wordCloud.setColorPalette(new ColorPalette(new Color(0x4055F1), new Color(0x408DF1), new Color(0x40AAF1), new Color(0x40C5F1), new Color(0x40D3F1), new Color(0xFFFFFF)));
wordCloud.setFontScalar(new LinearFontScalar(10, 40));
wordCloud.build(wordFrequencies);
wordCloud.writeToFile("whale_wordcloud_small.png");
}
but,the background of whale_wordcloud_small.png is a rectangle ,not a whale.
could anyone know how to resolve it?thanks
The text was updated successfully, but these errors were encountered:
Hi, do you know if "whale.jpg" has transparent pixels or if the bg is just white? Kumo works by placing text where ever it finds transparent pixels. A future feature request may be supporting a TRANSPARENT_COLOR, so that we can say "white or some other color is considered transparent"
Hi! @kennycason , I want to involve in this issue by adding the feature offering user the option to transparentize the background of the picture without a transparent background. I have wrote some code to provide the feature and will do the PR later.
The PR: #99
the code is ,
public static void gen() throws IOException {
final FrequencyAnalyzer frequencyAnalyzer = new FrequencyAnalyzer();
frequencyAnalyzer.setWordFrequenciesToReturn(70);
frequencyAnalyzer.setMinWordLength(3);
File f = new File("F:/temp/text.txt");
final List wordFrequencies = frequencyAnalyzer.load(new FileInputStream(f));
final Dimension dimension = new Dimension(500, 312);
final WordCloud wordCloud = new WordCloud(dimension, CollisionMode.PIXEL_PERFECT);
wordCloud.setPadding(2);
wordCloud.setBackground(new PixelBoundryBackground("F:/temp/whale.jpg"));
wordCloud.setColorPalette(new ColorPalette(new Color(0x4055F1), new Color(0x408DF1), new Color(0x40AAF1), new Color(0x40C5F1), new Color(0x40D3F1), new Color(0xFFFFFF)));
wordCloud.setFontScalar(new LinearFontScalar(10, 40));
wordCloud.build(wordFrequencies);
wordCloud.writeToFile("whale_wordcloud_small.png");
}
but,the background of whale_wordcloud_small.png is a rectangle ,not a whale.
could anyone know how to resolve it?thanks
The text was updated successfully, but these errors were encountered: