dankcli-lib 0.6.2__tar.gz → 0.6.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dankcli_lib
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Patched CLI Meme Generator/Caption Maker to automatically add whitespace and text to top and bottom
5
5
  Author: TheMrRedSlime
6
6
  License: MIT
@@ -10,11 +10,12 @@ Requires-Python: >=3.7
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: pillow
13
+ Requires-Dist: requests
13
14
  Dynamic: license-file
14
15
 
15
16
  # dankcli-lib
16
17
  [![PyPI version](https://img.shields.io/pypi/v/dankcli-lib.svg?label=PyPI)](https://pypi.org/project/dankcli-lib/)
17
- [![Python Version](https://img.shields.io/badge/Python-3.6%2B-blue.svg)](https://www.python.org/downloads/)
18
+ [![Python Version](https://img.shields.io/badge/Python-3.7%2B-blue.svg)](https://www.python.org/downloads/)
18
19
  [![Downloads](https://pepy.tech/badge/dankcli-lib)](https://pepy.tech/project/dankcli-lib)
19
20
 
20
21
  dankcli-lib is a CLI Image Captioning Tool, Meme Generator and Library which automatically adds white space and text to the top of your image.
@@ -52,7 +53,7 @@ with Caption("image.jpg", "Your text") as caption:
52
53
  from dankcli_lib.caption import Caption
53
54
  import discord
54
55
 
55
- caption = Caption("image.jpg", "Your text")
56
+ caption = Caption("https://example.com/image.jpg", "Your text")
56
57
  buffer = caption.to_buffer()
57
58
  await ctx.send(file=discord.File(buffer, "image.jpg"))
58
59
  caption.close()
@@ -88,3 +89,8 @@ to this
88
89
 
89
90
  ![](https://i.imgur.com/lSBUfNb.png)
90
91
 
92
+ ## Updates
93
+
94
+ ### 0.6.4
95
+
96
+ Added URL/Link support
@@ -1,6 +1,6 @@
1
1
  # dankcli-lib
2
2
  [![PyPI version](https://img.shields.io/pypi/v/dankcli-lib.svg?label=PyPI)](https://pypi.org/project/dankcli-lib/)
3
- [![Python Version](https://img.shields.io/badge/Python-3.6%2B-blue.svg)](https://www.python.org/downloads/)
3
+ [![Python Version](https://img.shields.io/badge/Python-3.7%2B-blue.svg)](https://www.python.org/downloads/)
4
4
  [![Downloads](https://pepy.tech/badge/dankcli-lib)](https://pepy.tech/project/dankcli-lib)
5
5
 
6
6
  dankcli-lib is a CLI Image Captioning Tool, Meme Generator and Library which automatically adds white space and text to the top of your image.
@@ -38,7 +38,7 @@ with Caption("image.jpg", "Your text") as caption:
38
38
  from dankcli_lib.caption import Caption
39
39
  import discord
40
40
 
41
- caption = Caption("image.jpg", "Your text")
41
+ caption = Caption("https://example.com/image.jpg", "Your text")
42
42
  buffer = caption.to_buffer()
43
43
  await ctx.send(file=discord.File(buffer, "image.jpg"))
44
44
  caption.close()
@@ -74,3 +74,8 @@ to this
74
74
 
75
75
  ![](https://i.imgur.com/lSBUfNb.png)
76
76
 
77
+ ## Updates
78
+
79
+ ### 0.6.4
80
+
81
+ Added URL/Link support
@@ -102,6 +102,7 @@ def main():
102
102
  # PNG supports transparency better, but we'll let the user specify format eventually
103
103
  is_jpeg = img_path.lower().endswith(('.jpg', '.jpeg'))
104
104
  extension = "jpg" if is_jpeg else "png"
105
+ extension = "gif" if img_path.lower().endswith(".gif") else "png"
105
106
  output_path = f"{out_name}.{extension}"
106
107
 
107
108
  # Generate and save
@@ -1,5 +1,6 @@
1
1
  from PIL import Image, ImageFont, ImageDraw
2
- import math, io
2
+ import math, io, requests
3
+ from urllib.parse import urlparse
3
4
 
4
5
  class Caption:
5
6
  """Handles image captioning with text overlay."""
@@ -28,7 +29,14 @@ class Caption:
28
29
  top_font_color: Font color for top text (defaults to black (0,0,0) if None)
29
30
  bottom_font_color: Font color for bottom text (defaults to white (255,255,255) if None)
30
31
  """
31
- self.image = Image.open(image_path)
32
+ #self.image = Image.open(image_path)
33
+ if parsed.scheme in ('http', 'https'):
34
+ response = requests.get(image_path, stream=True)
35
+ response.raise_for_status()
36
+ self.image = Image.open(io.BytesIO(response.content))
37
+ else:
38
+ self.image = Image.open(image_path)
39
+
32
40
  self.text = text.replace("\\n", "\n")
33
41
  self.bottom_text = bottom_text.replace("\\n", "\n") if bottom_text else None
34
42
  self.bottom_text_box = bottom_text_box
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dankcli_lib
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Patched CLI Meme Generator/Caption Maker to automatically add whitespace and text to top and bottom
5
5
  Author: TheMrRedSlime
6
6
  License: MIT
@@ -10,11 +10,12 @@ Requires-Python: >=3.7
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: pillow
13
+ Requires-Dist: requests
13
14
  Dynamic: license-file
14
15
 
15
16
  # dankcli-lib
16
17
  [![PyPI version](https://img.shields.io/pypi/v/dankcli-lib.svg?label=PyPI)](https://pypi.org/project/dankcli-lib/)
17
- [![Python Version](https://img.shields.io/badge/Python-3.6%2B-blue.svg)](https://www.python.org/downloads/)
18
+ [![Python Version](https://img.shields.io/badge/Python-3.7%2B-blue.svg)](https://www.python.org/downloads/)
18
19
  [![Downloads](https://pepy.tech/badge/dankcli-lib)](https://pepy.tech/project/dankcli-lib)
19
20
 
20
21
  dankcli-lib is a CLI Image Captioning Tool, Meme Generator and Library which automatically adds white space and text to the top of your image.
@@ -52,7 +53,7 @@ with Caption("image.jpg", "Your text") as caption:
52
53
  from dankcli_lib.caption import Caption
53
54
  import discord
54
55
 
55
- caption = Caption("image.jpg", "Your text")
56
+ caption = Caption("https://example.com/image.jpg", "Your text")
56
57
  buffer = caption.to_buffer()
57
58
  await ctx.send(file=discord.File(buffer, "image.jpg"))
58
59
  caption.close()
@@ -88,3 +89,8 @@ to this
88
89
 
89
90
  ![](https://i.imgur.com/lSBUfNb.png)
90
91
 
92
+ ## Updates
93
+
94
+ ### 0.6.4
95
+
96
+ Added URL/Link support
@@ -0,0 +1,2 @@
1
+ pillow
2
+ requests
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dankcli_lib"
7
- version = "0.6.2"
7
+ version = "0.6.4"
8
8
  description = "Patched CLI Meme Generator/Caption Maker to automatically add whitespace and text to top and bottom"
9
9
  readme = {file = "README.md", content-type = "text/markdown"}
10
10
  license = {text = "MIT"}
@@ -14,7 +14,8 @@ authors = [
14
14
  keywords = ["dankcli", "dank", "meme", "memegenerator", "memes", "generator", "pillow", "dankmemes", "dankcli-lib", "caption", "maker", "make"]
15
15
  requires-python = ">=3.7"
16
16
  dependencies = [
17
- "pillow"
17
+ "pillow",
18
+ "requests"
18
19
  ]
19
20
 
20
21
  [project.urls]
@@ -1 +0,0 @@
1
- pillow
File without changes
File without changes
File without changes