【问题标题】:Create image from file, containing all points (imagemagick)从文件创建图像,包含所有点(imagemagick)
【发布时间】:2011-03-05 21:51:02
【问题描述】:

我有一个大文件(约 100k 笔画),其中包含 (Y,X) 之类的点,其中坐标用前导零设置。

(001,042)
(012,706)
(412,760)
(001,790)

imagemagick 如何使图像大小为 1000x1000,并通过此坐标绘制点?

【问题讨论】:

    标签: bash imagemagick


    【解决方案1】:
    #!/bin/sh
    
    LOG_FILE=$1
    IMAGE_FILE=$2
    TMP_FILE="$LOG_FILE."
    
    convert -size 1000x1000 xc:white $IMAGE_FILE
    
    split -l 1000 $LOG_FILE $TMP_FILE -a 4
    
    for file in $TMP_FILE*
    do
        points=`cat $file | sed -r -e "s/\(//g" -e "s/\)//g" -e "s/^([0-9]{3}),([0-9]{3})$/point \2,\1/g"`
        convert $IMAGE_FILE -draw "$points" $IMAGE_FILE
    done
    
    rm $TMP_FILE*
    
    echo "done!"
    

    用法: ./file.sh coord.log points.png

    【讨论】:

      猜你喜欢
      • 2020-01-17
      • 2014-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-25
      • 2012-01-11
      • 2012-06-15
      • 1970-01-01
      相关资源
      最近更新 更多