我正在尝试使用 im4java 生成带有图案的图像上的文本示例图像。我的代码:
ConvertCmd convertCmd = new ConvertCmd();
IMOperation imOperation = new IMOperation();
imOperation.size(564, 564);
imOperation.tile(patternImg);
imOperation.background("none");
imOperation.stroke("black");
imOperation.strokewidth(2);
imOperation.fill("white");
imOperation.gravity("center");
imOperation.pointsize(40);
imOperation.border(3, 3);
imOperation.label(generateImageRequestDTO.getMainText());
imOperation.composite();
imOperation.addImage(absolutePathWorkDir + "/" + "test.jpg");
convertCmd.run(imOperation);
生成这样的脚本:
convert \
-size "564x564" -tile "/var/images/patterns/1.jpg" \
-background "none"-stroke "black" -strokewidth "2" -fill "white" \
-gravity "center"-pointsize "40" -border "3x3" -label "This is some text" \
-composite "/var/images/workdir/test.jpg"
这几乎是我需要的。这是我试图生成的代码:
convert \
-size "564x564" tile:"/var/images/patterns/1.jpg" \
-background "none"-stroke "black" -strokewidth "2" -fill "white" \
-gravity "center"-pointsize "40" -border "3x3" label:"This is some text" \
-composite "/var/images/workdir/test.jpg"
基本上
- -瓷砖==>瓷砖:
- -标签 ==>标签:
我在这里缺少什么?