emotional-face エクセルなどにコピペができるギザギザにならないemf 形式のスタンプを作ってみる

サイトを参考に作成方法は踏襲してパーツの変更と追加を行いました。プログラムの修正を行いemf 形式のエモーショナルフェイスを作成してみました

https://qiita.com/rmondo/items/4e089aa903e316620990

サンプル

emf のダウンロード

バッチファイル

echo e %*
md "y:\svg" 
copy "D:\app2\VSCode\svg\_contents1.svg"  "y:\svg" 

::@pwsh -Command  "& (Invoke-Expression -Command ('{' + (Get-Content %~f0 | Where-Object {$_.readcount -gt 9}| Out-String )+ '}'))" %*
::
@powershell -Command  "& (Invoke-Expression -Command ('{' + (Get-Content %~f0 | Where-Object {$_.readcount -gt 9}| Out-String )+ '}'))" %*
timeout /t 5&goto:eof


# 口
$mouth = @("a1","i1","u1","e1","o1","i2","i3","i4")
# 目
$eye = @("K","W","S","C","G","P","H","U")
# 眉
$brow = @("Flat","Smile","Up","Down")
Set-Location "D:\app2\VSCode\svg" 
$path4 = "D:\app2\VSCode\svg\_c.svg"
Set-Location "y:\svg" 


foreach($m in $mouth){
    foreach($e in $eye){
        foreach($b in $brow){
            $path = $m+ $e+ $b+ ".svg"
            $path1 = $m+ $e+ $b+ "1.svg"
            (Get-Content $path4) | %{ $_ -replace '_eye',$e} | %{ $_ -replace '_mouth',$m} | %{ $_ -replace '_brow',$b} | set-content $path
            D:\app2\inkscape\bin\inkscape.com $path --export-type=emf $path.emf
#
#            Select-String -Path $path -Raw -Pattern 'transform', '\/g'  -NotMatch | set-content $path1
#             (Get-Content $path1) | %{ $_ -replace '0 0 20 20', '0 0 120 120'} | set-content $path
#          D:\app2\inkscape\bin\inkscape.com $path --export-type=png $path.png
            Write-Host $path
            Start-Sleep -s 1
        }
    }
}
Start-Sleep -s 5

_contents1.svg

inkscapeを使って編集ができます UTF 8で保存します

inkscapeで保存する時はプレーン SVG にします

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   viewBox="3 3 104 104"
   version="1.1"
   id="svg2"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs1" />
  <!--顔-->
  <circle
     id="c"
     x="55"
     y="55"
     cx="55"
     cy="55"
     r="50"
     fill="none"
     stroke-width="2"
     stroke="#000000" />
  <!--口-->
  <path
     id="a1"
     x="55"
     y="55"
     d="m 55,72 h 25 a 25,25 0 1 1 -50,0 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="i1"
     d="M 26.2,79 H 83.8"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="u1"
     d="m 55.013677,70.614487 a 15.185406,7.4955463 13.290154 1 0 0,15.299984 6.6598522,13.871178 83.421165 0 0 0,13.387486"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="e1"
     d="m 55,66.936779 h 9.554065 l 9.554064,24.126442 H 35.891871 l 9.554064,-24.126442 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <circle
     id="o1"
     r="12"
     cx="55"
     cy="85"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="i2"
     d="m 28.275997,75.676221 c 6.615109,0 6.615109,3.92086 13.230218,3.92086 6.615109,0 6.615109,-3.92086 13.224706,-3.92086 6.609596,0 6.615109,3.92086 13.230218,3.92086 6.615109,0 6.615109,-3.92086 13.230218,-3.92086"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2.07914" />
  <path
     id="i3"
     d="m 83.391569,79.046188 a 13.059144,11.731543 0 0 1 -2.204261,2.069282 30.600653,27.48977 0 0 1 -12.266712,5.366272 53.453328,48.019228 0 0 1 -10.878028,1.405924 c -1.058045,0.04951 -2.160175,0.06931 -3.306391,0.06931 -15.154294,0 -23.012484,-4.20787 -26.451131,-6.841502 a 13.059144,11.731543 0 0 1 -2.204261,-2.069282"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2.08922" />
  <path
     id="i4"
     d="m 29.753571,88.068324 a 26.468624,23.879142 0 0 1 50.6224,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2.094" />
  <!--目-->
  <circle
     id="eyeLK"
     r="8"
     cx="31"
     cy="43"
     fill="#000000"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <circle
     id="eyeRK"
     r="8"
     cx="79"
     cy="43"
     fill="#000000"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <circle
     id="eyeLW"
     r="8"
     cx="31"
     cy="43"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <circle
     id="eyeRW"
     r="8"
     cx="79"
     cy="43"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeLS"
     d="m 19,51.4 a 12,12 0 1 1 24,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRS"
     d="m 91,51.4 a 12,12 0 1 0 -24,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeLC"
     d="m 19,39.4 a 12,12 0 0 0 24,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRC"
     d="m 91,39.4 a 12,12 0 0 1 -24,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeLG"
     d="M 19,37 43,49 H 16 43 L 19,61"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRG"
     d="M 91,37 67,49 H 94 67 l 24,12"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeLU"
     d="m 31.216429,46.167456 c -0.07414,0.659007 -0.924906,0.225194 -1.095313,-0.123222 -0.461794,-0.944188 0.462746,-1.892749 1.341758,-2.067405 1.572347,-0.312417 2.895173,1.078275 3.039495,2.560295 0.211799,2.174923 -1.698146,3.916219 -3.77883,4.011586 -2.773224,0.127109 -4.944533,-2.319035 -4.983677,-4.997366 -0.04926,-3.370407 2.940279,-5.976473 6.215902,-5.955768 3.967218,0.02508 7.010487,3.561699 6.927859,7.434438 -0.09737,4.563888 -4.183223,8.045798 -8.652974,7.899949 -5.160503,-0.168388 -9.081976,-4.804818 -8.87204,-9.871509 0.238542,-5.757097 5.426463,-10.118762 11.090045,-9.844132 6.353683,0.308094 11.155988,6.048147 10.816222,12.308581 -0.377204,6.95027 -6.669858,12.193546 -13.527117,11.788314"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRU"
     d="m 77.055291,46.167456 c -0.07414,0.659007 -0.924906,0.225194 -1.095313,-0.123222 -0.461794,-0.944188 0.462746,-1.892749 1.341758,-2.067405 1.572347,-0.312417 2.895173,1.078275 3.039495,2.560295 0.211799,2.174923 -1.698146,3.916219 -3.77883,4.011586 -2.773224,0.127109 -4.944533,-2.319035 -4.983677,-4.997366 -0.04926,-3.370407 2.940279,-5.976473 6.215902,-5.955768 3.967218,0.02508 7.010487,3.561699 6.927859,7.434438 -0.09737,4.563888 -4.183223,8.045798 -8.652974,7.899949 -5.160503,-0.168388 -9.081976,-4.804818 -8.87204,-9.871509 0.238542,-5.757097 5.426463,-10.118762 11.090045,-9.844132 6.353683,0.308094 11.155988,6.048147 10.816222,12.308581 -0.377204,6.95027 -6.669858,12.193546 -13.527117,11.788314"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeLP"
     d="m 39.102685,58.161139 -7.201989,-3.745679 -7.168518,3.809345 1.336815,-8.006977 -5.838096,-5.640514 8.028186,-1.202905 3.560377,-7.295374 3.624877,7.263541 8.038529,1.131724 -5.787889,5.692021 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRP"
     d="m 86.420221,58.65403 -7.201989,-3.745679 -7.168518,3.809345 1.336815,-8.006977 -5.838096,-5.640514 8.028186,-1.202905 3.560377,-7.295374 3.624877,7.263541 8.038529,1.131724 -5.787889,5.692021 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyeRH"
     d="m 77.883161,39.461127 c -2.15928,-2.516424 -5.767476,-3.294108 -8.472924,-0.98982 -2.70546,2.304288 -3.086352,6.156912 -0.96174,8.882232 1.766472,2.26584 7.112424,7.04484 8.864544,8.59164 0.19596,0.17304 0.294,0.25956 0.40836,0.29352 0.09972,0.02964 0.20892,0.02964 0.30876,0 0.11436,-0.03396 0.21228,-0.12048 0.40836,-0.29352 1.75212,-1.5468 7.098,-6.3258 8.86452,-8.59164 2.1246,-2.72532 1.79016,-6.602184 -0.9618,-8.882232 -2.75196,-2.280048 -6.2988,-1.526604 -8.45808,0.98982 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2.4" />
  <path
     id="eyeLH"
     d="m 32.208596,39.132533 c -2.15928,-2.516424 -5.767476,-3.294108 -8.472924,-0.98982 -2.70546,2.304288 -3.086352,6.156912 -0.96174,8.882232 1.766472,2.26584 7.112424,7.04484 8.864544,8.59164 0.19596,0.17304 0.294,0.25956 0.40836,0.29352 0.09972,0.02964 0.20892,0.02964 0.30876,0 0.11436,-0.03396 0.21228,-0.12048 0.40836,-0.29352 1.75212,-1.5468 7.098,-6.3258 8.86452,-8.59164 2.1246,-2.72532 1.79016,-6.602184 -0.9618,-8.882232 -2.75196,-2.280048 -6.2988,-1.526604 -8.45808,0.98982 z"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2.4" />
  <!--眉毛-->
  <path
     id="eyebrowLFlat"
     d="M 16.6,32.4 H 45.4"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowRFlat"
     d="M 93.4,32.4 H 64.6"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowLSmile"
     fill="none"
     d="m 17.040768,40.16484 a 15.881174,14.327485 0 0 1 30.37344,0"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowRSmile"
     d="m 62.715333,39.67195 a 15.881174,14.327485 0 0 1 30.373438,0"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowLUp"
     d="m 19.492891,26.4 24,9.6"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowRUp"
     d="M 91,26.4 67,36"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowLDown"
     d="M 14,36 38,26.4"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
  <path
     id="eyebrowRDown"
     d="M 96,36 72,26.4"
     fill="none"
     stroke="#000000"
     stroke-linejoin="round"
     stroke-linecap="round"
     stroke-width="2" />
</svg>

_C.svg

UTF 8で保存します

<svg xmlns="http://www.w3.org/2000/svg"  xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 20 20 ">
<g transform="scale(0.2) translate(1.2, 1.2) ">
<use xlink:href="_contents1.svg#c"  stroke="black" stroke-width="3" fill="none" />
<use id="mouth" xlink:href="_contents1.svg#_mouth"  stroke-width="3" />
    <use id="blowL" xlink:href="_contents1.svg#eyebrowL_brow"  stroke-width="3" />
    <use id="blowR" xlink:href="_contents1.svg#eyebrowR_brow"  stroke-width="3" />

    <use id="eyeL" xlink:href="_contents1.svg#eyeL_eye"  stroke-width="3" />
    <use id="eyeR" xlink:href="_contents1.svg#eyeR_eye"  stroke-width="3" />
</g>
</svg>