AI/빅데이터
CAIRO로 워드클라우드 생성하기 - mask_word_cloud (CAIRO, C++)
cepiloth
2021. 3. 31. 12:12
728x90
반응형
GIT 소스 경로
https://github.com/SalvaEB/mask_word_cloud
CAIRO로 렌더링 하는 프로그램인 거 같은데 실행해보지는 않았다. 이 프로젝트의 핵심은 단어를 모두 출력 후에 이미지 마스크를 사용한다는 점이다.
설치 및 컴파일 방법
sudo apt-get install libcairomm-1.0-dev
이후
make
maskwd실행 파일을 생성합니다 .
$ make
g++ -std=c++11 -O3 -c mask_word_cloud.cc `pkg-config --cflags --libs cairomm-1.0`
g++ -std=c++11 -O3 -o maskwc maskwc.cc mask_word_cloud.o `pkg-config --cflags --libs cairomm-1.0`
사용법
몇 가지 선택적인 매개 변수가 있습니다.
$ ./maskwc -h
Usage: ./maskwc \
[-h] \ (show this help)
[-r red_background] \ (RGB of background, default 0 0 0 black
[-g green_background] \ color components in scale 0-255
[-b blue_background] \
[-m mask_file] \ (determines also the size of image)
[-R red_mask] \ (words can be painted where mask
[-G green_mask] \ has this RGB color, default 0 0 0 black)
[-B blue_mask] \
[-c color_file] \ (must have the same size of mask, words colors are picked from here)
[-f font_name] \ (e.g. Sans)
[-s font_step] \ (default value 2, 1 is somewhat slower but more accurate)
[-M min_font_size] \ (default value 4)
[-o output_prefix] \ (default "output" generate "output.svg" "output.png" and "output.pdf")
[-d words_margin] \ (default value is 2)
[-v vertical_preference] \ (value between 0 and 100, default is 50)
words.txt (an ordered list of pairs word initial_size)
728x90
반응형