easy-captcha-python 0.1.0__tar.gz → 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {easy_captcha_python-0.1.0/easy_captcha_python.egg-info → easy_captcha_python-1.0.0}/PKG-INFO +122 -114
  2. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/README.md +420 -413
  3. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0/easy_captcha_python.egg-info}/PKG-INFO +122 -114
  4. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/pyproject.toml +6 -5
  5. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/LICENSE +0 -0
  6. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/MANIFEST.in +0 -0
  7. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/__init__.py +0 -0
  8. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/base/__init__.py +0 -0
  9. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/base/arithmetic_captcha_abstract.py +0 -0
  10. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/base/captcha.py +0 -0
  11. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/base/chinese_captcha_abstract.py +0 -0
  12. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/base/randoms.py +0 -0
  13. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/__init__.py +0 -0
  14. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/arithmetic_captcha.py +0 -0
  15. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/chinese_captcha.py +0 -0
  16. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/chinese_gif_captcha.py +0 -0
  17. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/gif_captcha.py +0 -0
  18. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/captcha/spec_captcha.py +0 -0
  19. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/constants.py +0 -0
  20. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/actionj.ttf +0 -0
  21. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/epilog.ttf +0 -0
  22. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/fresnel.ttf +0 -0
  23. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/headache.ttf +0 -0
  24. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/lexo.ttf +0 -0
  25. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/prefix.ttf +0 -0
  26. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/progbot.ttf +0 -0
  27. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/ransom.ttf +0 -0
  28. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/robot.ttf +0 -0
  29. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha/fonts/scandal.ttf +0 -0
  30. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha_python.egg-info/SOURCES.txt +0 -0
  31. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha_python.egg-info/dependency_links.txt +0 -0
  32. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha_python.egg-info/requires.txt +0 -0
  33. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/easy_captcha_python.egg-info/top_level.txt +0 -0
  34. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/setup.cfg +0 -0
  35. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/setup.py +0 -0
  36. {easy_captcha_python-0.1.0 → easy_captcha_python-1.0.0}/tests/test_spec_captcha.py +0 -0
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easy-captcha-python
3
- Version: 0.1.0
4
- Summary: Python图形验证码生成库,支持GIF、中文、算术等类型
3
+ Version: 1.0.0
4
+ Summary: Python graphic captcha generation library supporting GIF, Chinese characters, arithmetic and more
5
5
  Author-email: Kevin Roo <mostvegetableplayer@gmail.com>
6
6
  License: Apache-2.0
7
- Project-URL: Homepage, https://gitee.com/diamondore/EasyCaptcha-Python
8
- Project-URL: Repository, https://gitee.com/diamondore/EasyCaptcha-Python
9
- Keywords: captcha,verification code,gif,image,验证码
7
+ Project-URL: Homepage, https://github.com/Savlgoodman/EasyCaptcha-Python
8
+ Project-URL: Repository, https://github.com/Savlgoodman/EasyCaptcha-Python
9
+ Project-URL: Documentation, https://github.com/Savlgoodman/EasyCaptcha-Python/blob/master/docs/EASYCAPTCHA-PYTHON-USAGE.md
10
+ Keywords: captcha,verification code,gif,image
10
11
  Classifier: Development Status :: 4 - Beta
11
12
  Classifier: Intended Audience :: Developers
12
13
  Classifier: License :: OSI Approved :: Apache Software License
@@ -35,103 +36,105 @@ Dynamic: requires-python
35
36
  ![Python](https://img.shields.io/badge/python-3.7+-blue.svg)
36
37
  ![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)
37
38
 
38
- Python 图形验证码生成库,支持 GIF、中文、算术等类型,可用于 Python Web、桌面应用等项目。
39
+ > 🌐 **Language** | [English](README.md) | [中文](README_zh.md)
39
40
 
40
- 这是 [EasyCaptcha](https://github.com/whvcse/EasyCaptcha) Java 版本的 Python 实现。
41
+ Python graphic captcha generation library supporting GIF, Chinese characters, arithmetic, and other types. Suitable for Python Web, desktop applications, and more.
42
+
43
+ This is a Python implementation of the [EasyCaptcha](https://github.com/whvcse/EasyCaptcha) Java version.
41
44
 
42
45
  ---
43
46
 
44
- ## 1.简介
47
+ ## 1. Introduction
45
48
 
46
- &emsp;Python 图形验证码,支持 gif、中文、算术等类型,可用于 FlaskDjangoFastAPI Web 框架。
49
+ Python graphic captcha supporting GIF, Chinese characters, arithmetic, and other types. Compatible with Flask, Django, FastAPI, and other web frameworks.
47
50
 
48
51
  ---
49
52
 
50
- ## 2.效果展示
53
+ ## 2. Demo
51
54
 
52
- **PNG 类型:**
55
+ **PNG Type:**
53
56
 
54
- ![验证码](https://s2.ax1x.com/2019/08/23/msFrE8.png)
57
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msFrE8.png)
55
58
  &emsp;&emsp;
56
- ![验证码](https://s2.ax1x.com/2019/08/23/msF0DP.png)
59
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msF0DP.png)
57
60
  &emsp;&emsp;
58
- ![验证码](https://s2.ax1x.com/2019/08/23/msFwut.png)
61
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msFwut.png)
59
62
 
60
- **GIF 类型:**
63
+ **GIF Type:**
61
64
 
62
- ![验证码](https://s2.ax1x.com/2019/08/23/msFzVK.gif)
65
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msFzVK.gif)
63
66
  &emsp;&emsp;
64
- ![验证码](https://s2.ax1x.com/2019/08/23/msFvb6.gif)
67
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msFvb6.gif)
65
68
  &emsp;&emsp;
66
- ![验证码](https://s2.ax1x.com/2019/08/23/msFXK1.gif)
69
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msFXK1.gif)
67
70
 
68
- **算术类型:**
71
+ **Arithmetic Type:**
69
72
 
70
- ![验证码](https://s2.ax1x.com/2019/08/23/mskKPg.png)
73
+ ![Captcha](https://s2.ax1x.com/2019/08/23/mskKPg.png)
71
74
  &emsp;&emsp;
72
- ![验证码](https://s2.ax1x.com/2019/08/23/msknIS.png)
75
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msknIS.png)
73
76
  &emsp;&emsp;
74
- ![验证码](https://s2.ax1x.com/2019/08/23/mskma8.png)
77
+ ![Captcha](https://s2.ax1x.com/2019/08/23/mskma8.png)
75
78
 
76
- **中文类型:**
79
+ **Chinese Type:**
77
80
 
78
- ![验证码](https://s2.ax1x.com/2019/08/23/mskcdK.png)
81
+ ![Captcha](https://s2.ax1x.com/2019/08/23/mskcdK.png)
79
82
  &emsp;&emsp;
80
- ![验证码](https://s2.ax1x.com/2019/08/23/msk6Z6.png)
83
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msk6Z6.png)
81
84
  &emsp;&emsp;
82
- ![验证码](https://s2.ax1x.com/2019/08/23/msksqx.png)
85
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msksqx.png)
83
86
 
84
- **内置字体:**
87
+ **Built-in Fonts:**
85
88
 
86
- ![验证码](https://s2.ax1x.com/2019/08/23/msAVSJ.png)
89
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msAVSJ.png)
87
90
  &emsp;&emsp;
88
- ![验证码](https://s2.ax1x.com/2019/08/23/msAAW4.png)
91
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msAAW4.png)
89
92
  &emsp;&emsp;
90
- ![验证码](https://s2.ax1x.com/2019/08/23/msAkYF.png)
93
+ ![Captcha](https://s2.ax1x.com/2019/08/23/msAkYF.png)
91
94
 
92
95
  ---
93
96
 
94
- ## 3.安装
97
+ ## 3. Installation
95
98
 
96
- ### 3.1.使用 pip 安装
99
+ ### 3.1. Install via pip
97
100
 
98
101
  ```bash
99
102
  pip install easy-captcha-python
100
103
  ```
101
104
 
102
- ### 3.2.从源码安装
105
+ ### 3.2. Install from source
103
106
 
104
107
  ```bash
105
- git clone https://github.com/yourusername/easy-captcha-python.git
108
+ git clone https://github.com/Savlgoodman/EasyCaptcha-Python
106
109
  cd easy-captcha-python
107
110
  pip install -e .
108
111
  ```
109
112
 
110
113
  ---
111
114
 
112
- ## 4.使用方法
115
+ ## 4. Usage
113
116
 
114
- ### 4.1.快速开始
117
+ ### 4.1. Quick Start
115
118
 
116
119
  ```python
117
120
  from easy_captcha import SpecCaptcha
118
121
  from io import BytesIO
119
122
 
120
- # 三个参数分别为宽、高、位数
123
+ # Three parameters: width, height, character count
121
124
  captcha = SpecCaptcha(130, 48, 5)
122
125
 
123
- # 获取验证码文本
126
+ # Get captcha text
124
127
  code = captcha.text()
125
- print(f"验证码: {code}")
128
+ print(f"Captcha: {code}")
126
129
 
127
- # 输出到文件
130
+ # Write to file
128
131
  with open('captcha.png', 'wb') as f:
129
132
  stream = BytesIO()
130
133
  captcha.out(stream)
131
134
  f.write(stream.getvalue())
132
135
  ```
133
136
 
134
- ### 4.2.在 Flask 中使用
137
+ ### 4.2. Use with Flask
135
138
 
136
139
  ```python
137
140
  from flask import Flask, session, make_response
@@ -143,12 +146,12 @@ app.secret_key = 'your-secret-key'
143
146
 
144
147
  @app.route('/captcha')
145
148
  def captcha():
146
- # 创建验证码
149
+ # Create captcha
147
150
  cap = SpecCaptcha(130, 48, 5)
148
- # 验证码文本存入session
151
+ # Store captcha text in session
149
152
  session['captcha'] = cap.text().lower()
150
153
 
151
- # 输出图片
154
+ # Output image
152
155
  stream = BytesIO()
153
156
  cap.out(stream)
154
157
 
@@ -158,19 +161,19 @@ def captcha():
158
161
 
159
162
  @app.route('/verify/<code>')
160
163
  def verify(code):
161
- # 获取session中的验证码
164
+ # Get captcha from session
162
165
  if code.lower() == session.get('captcha'):
163
- return '验证成功'
164
- return '验证失败'
166
+ return 'Verification successful'
167
+ return 'Verification failed'
165
168
  ```
166
169
 
167
- 前端 HTML 代码:
170
+ Frontend HTML:
168
171
 
169
172
  ```html
170
173
  <img src="/captcha" width="130px" height="48px" />
171
174
  ```
172
175
 
173
- ### 4.3.在 Django 中使用
176
+ ### 4.3. Use with Django
174
177
 
175
178
  ```python
176
179
  from django.http import HttpResponse
@@ -179,17 +182,17 @@ from io import BytesIO
179
182
 
180
183
  def captcha(request):
181
184
  cap = SpecCaptcha(130, 48, 5)
182
- # 验证码文本存入session
185
+ # Store captcha text in session
183
186
  request.session['captcha'] = cap.text().lower()
184
187
 
185
- # 输出图片
188
+ # Output image
186
189
  stream = BytesIO()
187
190
  cap.out(stream)
188
191
 
189
192
  return HttpResponse(stream.getvalue(), content_type='image/png')
190
193
  ```
191
194
 
192
- ### 4.4.在 FastAPI 中使用
195
+ ### 4.4. Use with FastAPI
193
196
 
194
197
  ```python
195
198
  from fastapi import FastAPI, Response
@@ -209,16 +212,16 @@ async def captcha():
209
212
  return Response(content=stream.getvalue(), media_type="image/png")
210
213
  ```
211
214
 
212
- ### 4.5.前后端分离项目
215
+ ### 4.5. Frontend-Backend Separated Projects
213
216
 
214
- &emsp;前后端分离项目建议使用 base64 编码返回:
217
+ For frontend-backend separated projects, it is recommended to return base64 encoded images:
215
218
 
216
219
  ```python
217
220
  from flask import Flask, jsonify, request
218
221
  import uuid
219
222
 
220
223
  app = Flask(__name__)
221
- # 这里使用字典模拟,生产环境建议使用Redis
224
+ # Using dictionary as simulation, Redis is recommended for production
222
225
  captcha_store = {}
223
226
 
224
227
  @app.route('/captcha')
@@ -229,10 +232,10 @@ def get_captcha():
229
232
  code = cap.text().lower()
230
233
  key = str(uuid.uuid4())
231
234
 
232
- # 存储验证码(生产环境建议存到Redis并设置过期时间)
235
+ # Store captcha (recommend storing in Redis with expiration in production)
233
236
  captcha_store[key] = code
234
237
 
235
- # 返回keybase64图片
238
+ # Return key and base64 image
236
239
  return jsonify({
237
240
  'key': key,
238
241
  'image': cap.to_base64()
@@ -244,22 +247,22 @@ def login():
244
247
  ver_key = data.get('verKey')
245
248
  ver_code = data.get('verCode', '').lower()
246
249
 
247
- # 验证验证码
250
+ # Verify captcha
248
251
  if ver_code == captcha_store.get(ver_key):
249
- # 验证成功后删除
252
+ # Remove after successful verification
250
253
  captcha_store.pop(ver_key, None)
251
254
  return jsonify({'success': True})
252
- return jsonify({'success': False, 'message': '验证码错误'})
255
+ return jsonify({'success': False, 'message': 'Captcha error'})
253
256
  ```
254
257
 
255
- 前端使用示例:
258
+ Frontend example:
256
259
 
257
260
  ```html
258
261
  <img id="verImg" width="130px" height="48px" />
259
262
 
260
263
  <script>
261
264
  var verKey;
262
- // 获取验证码
265
+ // Fetch captcha
263
266
  fetch("/captcha")
264
267
  .then((res) => res.json())
265
268
  .then((data) => {
@@ -267,7 +270,7 @@ def login():
267
270
  document.getElementById("verImg").src = data.image;
268
271
  });
269
272
 
270
- // 登录
273
+ // Login
271
274
  fetch("/login", {
272
275
  method: "POST",
273
276
  headers: { "Content-Type": "application/json" },
@@ -285,9 +288,9 @@ def login():
285
288
 
286
289
  ---
287
290
 
288
- ## 5.更多设置
291
+ ## 5. More Settings
289
292
 
290
- ### 5.1.验证码类型
293
+ ### 5.1. Captcha Types
291
294
 
292
295
  ```python
293
296
  from easy_captcha import (
@@ -295,47 +298,48 @@ from easy_captcha import (
295
298
  ChineseGifCaptcha, ArithmeticCaptcha
296
299
  )
297
300
 
298
- # PNG类型
301
+ # PNG type
299
302
  captcha = SpecCaptcha(130, 48, 5)
300
- code = captcha.text() # 获取验证码文本
301
- chars = captcha.text_char() # 获取验证码字符数组
303
+ code = captcha.text() # Get captcha text
304
+ chars = captcha.text_char() # Get captcha character array
302
305
 
303
- # GIF类型
306
+ # GIF type
304
307
  captcha = GifCaptcha(130, 48, 5)
305
308
 
306
- # 中文类型
309
+ # Chinese type
307
310
  captcha = ChineseCaptcha(130, 48, 4)
308
311
 
309
- # 中文GIF类型
312
+ # Chinese GIF type
310
313
  captcha = ChineseGifCaptcha(130, 48, 4)
311
314
 
312
- # 算术类型
315
+ # Arithmetic type
313
316
  captcha = ArithmeticCaptcha(130, 48, 2)
314
- captcha.len = 3 # 几位数运算,默认是两位
315
- formula = captcha.get_arithmetic_string() # 获取运算公式:3+2=?
316
- result = captcha.text() # 获取运算结果:5
317
+ captcha.len = 3 # Number of digits for arithmetic, default is two
318
+ formula = captcha.get_arithmetic_string() # Get arithmetic formula: 3+2=?
319
+ result = captcha.text() # Get result: 5
317
320
 
318
- # 输出验证码
321
+ # Output captcha
319
322
  from io import BytesIO
320
323
  stream = BytesIO()
321
324
  captcha.out(stream)
322
325
  ```
323
326
 
324
- > 注意:<br/> > &emsp;算术验证码的 len 表示是几位数运算,而其他验证码的 len 表示验证码的位数,算术验证码的 text()表示的是公式的结果,
325
- > 对于算术验证码,你应该把公式的结果存储到 session,而不是公式。
327
+ > Note:<br/>
328
+ > &emsp;For arithmetic captcha, `len` represents the number of digits in the operation, while for other captchas `len` represents the number of characters. The `text()` method for arithmetic captcha returns the result of the formula.
329
+ > For arithmetic captcha, you should store the result in session, not the formula itself.
326
330
 
327
- ### 5.2.验证码字符类型
331
+ ### 5.2. Character Types
328
332
 
329
- | 类型 | 描述 |
330
- | :----------------- | :------------- |
331
- | TYPE_DEFAULT | 数字和字母混合 |
332
- | TYPE_ONLY_NUMBER | 纯数字 |
333
- | TYPE_ONLY_CHAR | 纯字母 |
334
- | TYPE_ONLY_UPPER | 纯大写字母 |
335
- | TYPE_ONLY_LOWER | 纯小写字母 |
336
- | TYPE_NUM_AND_UPPER | 数字和大写字母 |
333
+ | Type | Description |
334
+ | :----------------- | :-------------------- |
335
+ | TYPE_DEFAULT | Numbers and letters |
336
+ | TYPE_ONLY_NUMBER | Numbers only |
337
+ | TYPE_ONLY_CHAR | Letters only |
338
+ | TYPE_ONLY_UPPER | Uppercase only |
339
+ | TYPE_ONLY_LOWER | Lowercase only |
340
+ | TYPE_NUM_AND_UPPER | Numbers and uppercase |
337
341
 
338
- 使用方法:
342
+ Usage:
339
343
 
340
344
  ```python
341
345
  from easy_captcha import SpecCaptcha, TYPE_ONLY_NUMBER
@@ -344,14 +348,14 @@ captcha = SpecCaptcha(130, 48, 5)
344
348
  captcha.char_type = TYPE_ONLY_NUMBER
345
349
  ```
346
350
 
347
- > 只有`SpecCaptcha`和`GifCaptcha`设置才有效果。
351
+ > Only effective for `SpecCaptcha` and `GifCaptcha`.
348
352
 
349
- ### 5.3.字体设置
353
+ ### 5.3. Font Settings
350
354
 
351
- 内置字体:
355
+ Built-in fonts:
352
356
 
353
- | 字体 | 效果 |
354
- | :------ | :--------------------------------------------- |
357
+ | Font | Preview |
358
+ | :------ | :------------------------------------------- |
355
359
  | FONT_1 | ![](https://s2.ax1x.com/2019/08/23/msMe6U.png) |
356
360
  | FONT_2 | ![](https://s2.ax1x.com/2019/08/23/msMAf0.png) |
357
361
  | FONT_3 | ![](https://s2.ax1x.com/2019/08/23/msMCwj.png) |
@@ -363,22 +367,22 @@ captcha.char_type = TYPE_ONLY_NUMBER
363
367
  | FONT_9 | ![](https://s2.ax1x.com/2019/08/23/msMVpV.png) |
364
368
  | FONT_10 | ![](https://s2.ax1x.com/2019/08/23/msMZlT.png) |
365
369
 
366
- 使用方法:
370
+ Usage:
367
371
 
368
372
  ```python
369
373
  from easy_captcha import SpecCaptcha, FONT_1, FONT_2
370
374
 
371
375
  captcha = SpecCaptcha(130, 48, 5)
372
376
 
373
- # 设置内置字体
377
+ # Set built-in font
374
378
  captcha.set_font(FONT_1, size=32)
375
379
 
376
- # 也可以使用系统字体(需要PIL.ImageFont支持)
380
+ # You can also use system fonts (requires PIL.ImageFont support)
377
381
  from PIL import ImageFont
378
382
  captcha._font = ImageFont.truetype("arial.ttf", 32)
379
383
  ```
380
384
 
381
- ### 5.4.输出 base64 编码
385
+ ### 5.4. Output base64
382
386
 
383
387
  ```python
384
388
  from easy_captcha import SpecCaptcha
@@ -386,11 +390,11 @@ from easy_captcha import SpecCaptcha
386
390
  captcha = SpecCaptcha(130, 48, 5)
387
391
  base64_str = captcha.to_base64()
388
392
 
389
- # 如果不想要base64的头部data:image/png;base64,
390
- base64_str = captcha.to_base64("") # 加一个空的参数即可
393
+ # If you don't want the base64 header "data:image/png;base64,"
394
+ base64_str = captcha.to_base64("") # Just pass an empty parameter
391
395
  ```
392
396
 
393
- ### 5.5.输出到文件
397
+ ### 5.5. Output to File
394
398
 
395
399
  ```python
396
400
  from easy_captcha import SpecCaptcha
@@ -398,7 +402,7 @@ from io import BytesIO
398
402
 
399
403
  captcha = SpecCaptcha(130, 48, 5)
400
404
 
401
- # 输出到文件
405
+ # Write to file
402
406
  with open('captcha.png', 'wb') as f:
403
407
  stream = BytesIO()
404
408
  captcha.out(stream)
@@ -407,39 +411,43 @@ with open('captcha.png', 'wb') as f:
407
411
 
408
412
  ---
409
413
 
410
- ## 6.完整示例
414
+ ## 6. Complete Examples
411
415
 
412
- 查看 `examples/` 目录获取更多示例:
416
+ Check the `examples/` directory for more examples:
413
417
 
414
- - `basic_usage.py` - 基本使用示例
415
- - `all_types_demo.py` - 所有验证码类型演示
418
+ - `basic_usage.py` - Basic usage example
419
+ - `all_types_demo.py` - All captcha types demo
416
420
 
417
- 运行示例:
421
+ Run examples:
418
422
 
419
423
  ```bash
420
- # 运行基本示例
424
+ # Run basic example
421
425
  python examples/basic_usage.py
422
426
 
423
- # 运行完整演示
427
+ # Run full demo
424
428
  python examples/all_types_demo.py
425
429
  ```
426
430
 
427
- 所有生成的验证码图片将保存到 `./out/` 目录。
431
+ All generated captcha images will be saved to the `./out/` directory.
428
432
 
429
433
  ---
430
434
 
431
- ## 7.许可证
435
+ ## 7. License
432
436
 
433
437
  Apache License 2.0
434
438
 
435
439
  ---
436
440
 
437
- ## 8.致谢
441
+ ## 8. Acknowledgments
438
442
 
439
- 本项目是 [EasyCaptcha](https://github.com/whvcse/EasyCaptcha) 的 Python 实现版本。
443
+ This project is a Python implementation of [EasyCaptcha](https://github.com/whvcse/EasyCaptcha).
440
444
 
441
445
  ---
442
446
 
443
- ## 9.贡献
447
+ ## 9. Contributing
448
+
449
+ Issues and Pull Requests are welcome!
450
+
451
+ ## 10. References
444
452
 
445
- 欢迎提交 Issue Pull Request!
453
+ For more detailed documentation, please refer to the [Usage Guide](https://github.com/Savlgoodman/EasyCaptcha-Python/blob/master/docs/EASYCAPTCHA-PYTHON-USAGE.md).