c++ - Image Magick slow drawing -
i trying draw bunch of lines on image using image magick library (magick++ api) , total execution time appears quite large.
are there ways optimize imagick drawing performance?
int size = 700, lines_num = 6000; image outputimage(geometry(size, size), color("white")); (int = 0; < lines_num; i++) { outputimage.draw(drawableline(lines[i].x1,lines[i].y1, lines[i].x2,lines[i].y2)); }
try avoid repeat magick::image.draw
calls.
std::vector<magick::drawable> drawlist; (int = 0; < lines_num; i++) { drawlist.push_back(drawableline(lines[i].x1,lines[i].y1, lines[i].x2,lines[i].y2)); } outputimage.draw(drawlist);
also ensure imagemagick libraries have been compiled openmp
support. if going speed, , not quality, recommend recompiling without high dynamic range imagery --enable-hdri=no
, , low quantum depth --with-quantum-depth=8
.
Comments
Post a Comment