首页 > 编程语言 >python svg 验证码处理

python svg 验证码处理

时间:2022-11-28 18:57:52浏览次数:39  
标签:pil python svg 验证码 mysvg2rlg ddddocr drawToString drawing

 

 

 

 

<svg xmlns="http://www.w3.org/2000/svg" width="130" height="55" viewBox="0,0,130,55"><rect width="100%" height="100%" fill="#b5b9b9"/><path fill="#775e6b" d="M96.78 42.82L96.85 42.89L96.91 42.95Q92.79 43.13 91.80 40.81L91.83 40.84L91.69 40.70Q92.63 39.92 94.19 38.13L94.19 38.13L94.16 38.10Q94.51 39.98 97.52 40.10L97.66 40.24L97.60 40.17Q101.00 40.26 102.64 38.93L102.55 38.84L102.64 38.93Q104.13 37.42 104.06 34.71L104.02 34.67L103.90 34.56Q103.85 29.59 99.05 29.82L99.01 29.78L99.10 29.88Q96.19 29.94 94.44 31.19L94.53 31.28L94.12 31.02L93.83 30.81L93.92 30.89Q94.30 27.77 94.18 25.03L94.07 24.92L94.24 25.08Q94.11 22.45 93.77 19.14L93.68 19.04L93.59 18.95Q97.33 19.99 101.14 19.88L101.14 19.88L101.16 19.90Q105.02 19.88 108.60 18.63L108.46 18.49L108.03 20.14L107.98 20.09Q107.70 20.88 107.50 21.72L107.40 21.61L107.55 21.76Q104.25 22.61 100.36 22.61L100.50 22.75L100.47 22.71Q98.95 22.65 97.47 22.49L97.50 22.53L97.46 22.48Q97.52 23.30 97.17 27.76L97.02 27.60L97.16 27.74Q98.03 27.31 100.08 27.16L99.91 26.99L100.01 27.09Q103.73 27.31 105.17 28.98L105.21 29.02L105.27 29.08Q106.56 30.52 106.83 34.37L106.78 34.32L106.83 34.37Q107.14 38.60 105.92 40.61L105.82 40.51L105.85 40.54Q103.89 42.51 100.58 42.74L100.51 42.67L100.62 42.78Q99.60 42.82 96.93 42.97ZM102.85 45.12L102.95 45.22L102.85 45.12Q106.28 45.20 108.18 44.09L108.16 44.08L108.22 44.13Q109.23 42.63 109.23 40.53L109.18 40.49L109.12 40.42Q109.31 37.53 108.36 33.42L108.25 33.31L108.22 33.29Q107.88 31.57 106.66 30.16L106.63 30.14L106.65 30.19L106.57 30.03L106.04 29.66L106.22 29.84Q105.77 28.96 105.12 28.28L105.20 28.36L105.09 28.29L105.23 28.43Q103.66 26.70 99.97 26.70L100.05 26.79L99.78 26.78L99.70 26.70Q99.78 26.14 99.97 25.03L99.95 25.01L99.87 24.93Q104.88 25.07 108.92 23.44L108.93 23.45L108.98 23.50Q109.37 22.06 110.33 19.25L110.34 19.26L108.23 20.19L108.34 20.31Q108.63 19.08 109.13 17.94L109.08 17.89L109.07 17.88Q105.29 19.39 101.18 19.46L101.27 19.55L101.16 19.45Q97.05 19.56 93.09 18.46L93.09 18.46L93.14 18.50Q93.85 22.95 93.85 27.37L93.79 27.31L93.73 27.25Q93.88 29.30 93.77 31.20L93.67 31.11L93.70 31.13Q93.89 31.25 94.46 31.56L94.60 31.70L94.47 31.56Q94.94 31.46 95.59 31.12L95.42 30.95L95.55 31.08Q95.49 31.82 95.26 33.34L95.34 33.42L95.18 33.26Q95.59 33.44 96.01 33.67L96.15 33.81L95.99 33.66Q98.79 31.93 100.66 31.93L100.80 32.07L100.78 32.05Q102.03 31.96 103.21 32.61L103.33 32.74L103.31 32.71Q103.55 33.64 103.59 34.59L103.53 34.53L103.70 34.70Q103.63 37.15 102.61 38.25L102.68 38.32L102.72 38.37Q101.25 39.48 99.00 39.71L99.05 39.75L98.98 39.69Q98.18 39.92 97.50 39.84L97.49 39.83L97.50 39.85Q96.56 39.63 95.80 39.28L95.82 39.30L95.76 39.06L95.73 39.26L95.74 39.27Q94.86 38.69 94.33 37.36L94.33 37.36L94.40 37.43Q93.01 38.78 91.33 40.91L91.39 40.97L91.41 40.99Q91.58 41.50 92.41 42.45L92.43 42.47L92.53 42.57Q93.60 44.40 96.42 44.89L96.44 44.91L96.28 44.75Q97.49 45.01 102.86 45.13Z"/><path d="M13 42 C69 19,74 50,129 46" stroke="#63a8ec" fill="none"/><path fill="#557666" d="M77.63 29.59L77.72 29.68L77.79 29.74Q78.54 29.70 79.95 29.55L79.89 29.49L79.93 29.53Q79.89 30.18 79.89 30.82L79.81 30.74L79.90 32.08L79.85 32.04Q79.11 32.13 78.27 32.21L78.17 32.10L78.28 32.22Q77.27 32.08 76.43 32.04L76.51 32.12L76.61 32.22Q73.70 38.34 70.28 42.94L70.29 42.96L70.26 42.92Q67.81 43.64 66.52 44.25L66.49 44.22L66.36 44.09Q70.60 38.51 73.65 32.23L73.58 32.16L70.89 32.09L70.94 32.15Q70.99 30.87 70.88 29.54L70.87 29.53L70.93 29.59Q72.84 29.75 74.90 29.75L74.76 29.61L76.72 25.97L76.79 26.04Q77.81 24.17 79.03 22.57L79.00 22.54L78.84 22.38Q77.40 22.65 75.80 22.65L75.76 22.61L75.74 22.60Q69.68 22.63 65.91 20.42L65.88 20.39L65.23 18.68L65.32 18.77Q64.97 17.92 64.59 17.04L64.54 16.99L64.51 16.97Q68.87 19.61 74.58 19.84L74.66 19.92L74.55 19.81Q79.78 20.12 84.92 18.14L84.84 18.07L84.88 18.11Q84.75 18.58 84.25 19.46L84.28 19.49L84.18 19.38Q80.65 24.23 77.79 29.75ZM85.75 20.73L85.78 20.76L86.74 18.71L86.81 18.78Q85.87 19.28 84.19 20.01L84.21 20.02L84.34 19.66L84.35 19.67Q84.43 19.48 84.54 19.37L84.64 19.47L84.58 19.40Q85.01 18.77 85.73 17.44L85.63 17.33L85.63 17.33Q80.35 19.66 74.60 19.43L74.55 19.39L74.64 19.48Q68.56 19.15 63.80 16.18L63.87 16.25L63.74 16.11Q64.90 18.11 65.73 20.77L65.73 20.77L65.72 20.76Q66.74 21.32 67.54 21.63L67.66 21.75L67.65 21.74Q67.84 22.11 68.29 23.98L68.15 23.84L68.22 23.90Q71.35 25.14 76.87 24.98L76.89 25.00L76.97 25.09Q76.61 25.60 74.63 29.37L74.68 29.41L74.61 29.35Q72.57 29.36 70.59 29.17L70.52 29.10L70.52 29.10Q70.72 30.06 70.72 30.94L70.68 30.90L70.56 32.50L72.23 32.49L72.27 33.94L72.34 34.01Q68.32 41.29 65.54 44.87L65.55 44.88L65.62 44.95Q67.20 44.16 68.83 43.67L68.89 43.73L68.82 43.65Q68.26 44.69 66.89 46.40L66.79 46.30L66.70 46.22Q69.93 45.19 72.37 44.96L72.44 45.03L72.38 44.97Q75.26 41.14 78.38 34.37L78.42 34.41L81.93 34.68L81.92 34.68Q81.89 33.81 81.89 32.89L81.86 32.86L81.71 30.93L81.73 30.95Q81.42 30.91 80.87 30.94L81.03 31.10L81.03 31.11Q80.37 31.04 80.11 31.04L80.10 31.02L80.07 30.99Q80.06 30.87 80.09 30.72L80.13 30.76L80.22 30.58L80.19 30.55Q82.73 25.43 85.81 20.79Z"/><path d="M3 2 C64 36,46 43,126 36" stroke="#42ea42" fill="none"/><path fill="#7d686d" d="M20.02 42.85L20.14 42.97L19.96 42.80Q15.99 43.13 15.00 40.81L14.99 40.80L14.90 40.70Q15.75 39.84 17.31 38.05L17.27 38.02L17.38 38.13Q17.73 40.00 20.74 40.11L20.87 40.24L20.75 40.13Q24.20 40.27 25.84 38.93L25.92 39.01L25.83 38.92Q27.25 37.34 27.18 34.64L27.21 34.67L27.22 34.68Q26.94 29.49 22.14 29.72L22.16 29.73L22.21 29.78Q19.44 29.98 17.68 31.23L17.56 31.11L17.33 31.03L17.11 30.89L17.04 30.82Q17.49 27.76 17.37 25.02L17.37 25.02L17.38 25.03Q17.24 22.37 16.89 19.06L16.81 18.97L16.89 19.05Q20.51 19.97 24.31 19.85L24.25 19.80L24.37 19.91Q28.10 19.76 31.68 18.50L31.70 18.52L31.13 20.05L31.23 20.15Q30.87 20.86 30.68 21.69L30.63 21.64L30.65 21.66Q27.54 22.70 23.66 22.70L23.59 22.63L23.70 22.74Q22.30 22.79 20.82 22.64L20.66 22.48L20.77 22.60Q20.56 23.15 20.22 27.60L20.39 27.77L20.37 27.75Q21.12 27.20 23.17 27.05L23.22 27.09L23.23 27.11Q26.95 27.33 28.40 29.01L28.38 28.98L28.35 28.96Q29.80 30.56 30.07 34.40L29.97 34.31L29.95 34.29Q30.20 38.46 28.98 40.47L29.08 40.58L29.01 40.50Q26.96 42.37 23.65 42.60L23.79 42.75L23.72 42.68Q22.62 42.64 19.95 42.79ZM26.00 45.07L26.06 45.13L26.19 45.26Q29.49 45.21 31.39 44.10L31.45 44.16L31.34 44.05Q32.40 42.60 32.40 40.50L32.33 40.43L32.46 40.57Q32.39 37.41 31.44 33.30L31.41 33.27L31.45 33.31Q31.06 31.55 29.84 30.14L29.91 30.21L29.97 30.31L29.66 29.92L29.32 29.74L29.29 29.70Q28.98 28.97 28.33 28.29L28.31 28.27L28.43 28.42L28.41 28.40Q26.86 26.70 23.17 26.70L23.10 26.64L22.95 26.76L22.90 26.70Q22.88 26.04 23.07 24.94L23.17 25.04L23.24 25.10Q28.06 25.05 32.10 23.41L32.12 23.44L32.19 23.51Q32.57 22.06 33.52 19.24L33.54 19.26L31.48 20.24L31.53 20.29Q31.91 19.15 32.40 18.01L32.37 17.98L32.40 18.00Q28.59 19.48 24.47 19.56L24.47 19.55L24.36 19.45Q20.21 19.52 16.25 18.42L16.24 18.41L16.25 18.41Q16.90 22.80 16.90 27.22L17.09 27.41L16.93 27.24Q17.09 29.31 16.98 31.21L16.82 31.05L16.82 31.05Q17.08 31.24 17.65 31.55L17.75 31.64L17.62 31.51Q18.05 31.37 18.70 31.03L18.74 31.07L18.72 31.05Q18.67 31.80 18.44 33.32L18.45 33.33L18.34 33.22Q18.79 33.44 19.21 33.67L19.29 33.75L19.38 33.84Q21.99 31.92 23.85 31.92L23.99 32.05L24.00 32.07Q25.16 31.90 26.34 32.54L26.40 32.60L26.40 32.61Q26.77 33.66 26.81 34.61L26.88 34.69L26.72 34.52Q26.93 37.25 25.90 38.35L25.80 38.24L25.81 38.26Q24.52 39.55 22.27 39.78L22.29 39.79L22.25 39.76Q21.26 39.80 20.57 39.72L20.53 39.67L20.58 39.73Q19.74 39.61 18.98 39.27L19.10 39.38L19.01 39.11L18.93 39.25L18.83 39.16Q18.09 38.72 17.55 37.38L17.52 37.35L17.53 37.36Q16.27 38.84 14.59 40.97L14.60 40.98L14.51 40.89Q14.91 41.63 15.75 42.58L15.58 42.41L15.66 42.49Q16.80 44.40 19.62 44.90L19.56 44.83L19.51 44.78Q20.74 45.06 26.11 45.18Z"/><path fill="#555c59" d="M44.46 35.55L44.33 35.42L44.28 35.37Q47.39 35.02 50.59 35.13L50.60 35.14L50.68 35.22Q50.52 32.55 50.52 30.15L50.71 30.34L50.65 30.28Q50.57 27.73 50.76 25.18L50.81 25.23L50.78 25.20Q49.49 26.84 44.27 35.36ZM54.17 42.71L54.19 42.73L54.26 42.80Q52.53 42.44 50.74 42.36L50.72 42.34L50.70 42.33Q50.69 40.14 50.57 37.67L50.48 37.58L50.42 37.51Q45.21 37.44 40.49 38.85L40.36 38.73L40.41 38.77Q40.48 38.23 40.67 37.24L40.84 37.41L40.69 37.26Q42.51 34.13 46.09 27.85L46.20 27.96L46.20 27.96Q49.02 23.02 52.45 19.14L52.48 19.17L52.47 19.16Q53.23 18.85 54.91 18.59L55.08 18.76L54.91 18.59Q53.03 25.05 53.03 32.09L53.18 32.24L53.11 32.17Q53.09 33.63 53.16 35.12L53.19 35.14L54.46 35.24L54.40 35.17Q55.11 35.31 55.72 35.43L55.58 35.28L55.73 35.44Q55.76 36.35 56.03 38.29L56.15 38.40L56.13 38.39Q54.89 38.10 53.40 37.91L53.41 37.91L53.31 37.82Q53.58 39.87 54.26 42.80ZM55.93 34.99L56.03 35.09L55.95 35.01Q55.83 35.01 55.64 35.01L55.65 35.01L55.19 34.93L55.12 34.87Q55.14 33.52 55.14 32.11L55.14 32.11L55.10 32.07Q55.08 25.65 57.14 19.64L57.21 19.71L57.21 19.71Q56.46 19.98 55.01 20.37L54.98 20.34L54.94 20.30Q55.15 19.52 55.61 18.11L55.54 18.04L55.60 18.10Q54.28 18.46 52.23 18.69L52.33 18.79L52.27 18.73Q48.27 22.99 43.06 32.36L43.18 32.48L45.15 28.70L45.27 28.82Q44.83 29.83 44.56 30.40L44.49 30.32L40.15 39.47L39.98 39.29Q40.63 39.14 41.77 38.76L41.95 38.94L41.73 39.11L41.63 39.00Q41.55 39.72 41.24 40.98L41.19 40.92L41.23 40.96Q45.47 39.76 50.30 39.95L50.32 39.97L50.15 39.80Q50.20 40.75 50.39 42.73L50.55 42.89L50.40 42.75Q51.47 42.76 52.54 42.87L52.56 42.89L52.56 42.89Q52.80 43.67 53.07 45.04L53.04 45.01L52.93 44.89Q55.01 45.30 58.02 46.22L57.83 46.02L57.89 46.08Q56.84 43.90 55.93 40.63L56.10 40.79L57.38 41.09L57.41 41.12Q58.05 41.30 58.73 41.64L58.81 41.72L58.86 41.76Q58.01 39.20 57.86 37.53L57.85 37.52L57.93 37.60Q57.23 37.32 56.09 37.09L56.14 37.14L56.12 37.12Q55.89 35.82 55.89 34.95ZM47.96 34.86L47.92 34.82L48.04 34.94Q48.63 33.48 50.19 30.93L50.33 31.06L50.30 31.03Q50.24 31.93 50.20 32.88L50.32 33.00L50.23 32.90Q50.20 33.87 50.24 34.82L50.33 34.91L50.19 34.77Q49.68 34.79 49.11 34.79L49.14 34.82L49.11 34.80Q48.63 34.92 48.02 34.92Z"/></svg>

 

 

 

with open('file.svg', 'r', encoding='utf-8') as f:
    c = f.read()
    
drawing = mysvg2rlg(c)
pil = renderPM.drawToString(drawing, 'PNG')

import ddddocr
sdk = ddddocr.DdddOcr()
ff = sdk.classification(pil)
print(ff)

 

 

 

from svglib.svglib import svg2rlg, mysvg2rlg
drawing = mysvg2rlg(cstring)
pil = renderPM.drawToString(drawing, 'PNG')

 

 

 

 

如果需要 

mysvg2rlg 方法 vx 支付5元 红包

    添加备注  购买svg代码

标签:pil,python,svg,验证码,mysvg2rlg,ddddocr,drawToString,drawing
From: https://www.cnblogs.com/angdh/p/16933036.html

相关文章