svg-ultralight 0.45.4__py3-none-any.whl → 0.45.5__py3-none-any.whl

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.

Potentially problematic release.


This version of svg-ultralight might be problematic. Click here for more details.

@@ -70,7 +70,7 @@ def _symmetric_crop(
70
70
 
71
71
 
72
72
  def _crop_image_to_bbox_ratio(
73
- image: ImageType, bbox: BoundingBox, center: tuple[float, float] | None = None
73
+ image: ImageType, bbox: BoundingBox, center: tuple[float, float] | None
74
74
  ) -> ImageType:
75
75
  """Crop an image to the ratio of a bounding box.
76
76
 
@@ -116,8 +116,8 @@ def _get_svg_embedded_image_str(image: ImageType) -> str:
116
116
 
117
117
  def new_image_elem_in_bbox(
118
118
  filename: str | os.PathLike[str],
119
- bbox: BoundingBox,
120
- center: tuple[float, float] | None,
119
+ bbox: BoundingBox | None = None,
120
+ center: tuple[float, float] | None = None,
121
121
  ) -> EtreeElement:
122
122
  """Create a new svg image element inside a bounding box.
123
123
 
@@ -128,6 +128,9 @@ def new_image_elem_in_bbox(
128
128
  (0.4, 0.5) would crop 20% off the right side of the image.
129
129
  :return: an etree image element with the cropped image embedded
130
130
  """
131
+ image = Image.open(filename)
132
+ if bbox is None:
133
+ bbox = BoundingBox(0, 0, image.width, image.height)
131
134
  image = _crop_image_to_bbox_ratio(Image.open(filename), bbox, center)
132
135
  svg_image = new_element("image", **bbox_dict(bbox))
133
136
  svg_image.set(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: svg-ultralight
3
- Version: 0.45.4
3
+ Version: 0.45.5
4
4
  Summary: a sensible way to create svg files with Python
5
5
  Author-email: Shay Hill <shay_public@hotmail.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  svg_ultralight/__init__.py,sha256=3YdTZfa0xUDrPCbOVyx39D9ENks-JEtsi9DFZzvaTf0,2755
2
2
  svg_ultralight/animate.py,sha256=SMcQkeWAP9dD08Iyzy9qGG8Qk1p-14WfrB7WSN8Pj_4,1133
3
3
  svg_ultralight/attrib_hints.py,sha256=oCF20eG06vg2Tuapk1A14ovN7ZqZoZ43d-um_Zh0BPs,418
4
- svg_ultralight/image_ops.py,sha256=6V9YkxnhZCBw_hbVyY0uxDj0pZgiEWBSGRuPuOYKY4w,4694
4
+ svg_ultralight/image_ops.py,sha256=6xw0os6O3mRgaZOclb0bvGdy3EjQR9rCwEFP_UhvQV0,4825
5
5
  svg_ultralight/inkscape.py,sha256=ySCxWnQwEt1sosa1b4mEkR-ugpfoAeg9gs1OLPS69iI,9597
6
6
  svg_ultralight/layout.py,sha256=7LV2I3u4EhqSc6ASvgwDtTZyV-Y1qt2wtvRtH2uKVAE,12799
7
7
  svg_ultralight/main.py,sha256=zaqWc5y9tsJoyNhpX2gIHKj1ZGEcfJebxNCcRQyoziU,7857
@@ -29,7 +29,7 @@ svg_ultralight/font_tools/font_info.py,sha256=-MEEM8Jslirevocv97RNRaArxaP3xeNiB7
29
29
  svg_ultralight/font_tools/globs.py,sha256=JdrrGMqDtD4WcY7YGUWV43DUW63RVev-x9vWqsQUhxU,119
30
30
  svg_ultralight/strings/__init__.py,sha256=BMGhF1pulscIgkiYvZLr6kPRR0L4lW0jUNFxkul4_EM,295
31
31
  svg_ultralight/strings/svg_strings.py,sha256=FQNxNmMkR2M-gCFo_woQKXLgCHi3ncUlRMiaRR_a9nQ,1978
32
- svg_ultralight-0.45.4.dist-info/METADATA,sha256=0EFsA3w0Xh52UjUrfVkTXP6_7840gS9YGai2pGOt-nI,9052
33
- svg_ultralight-0.45.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
- svg_ultralight-0.45.4.dist-info/top_level.txt,sha256=se-6yqM_0Yg5orJKvKWdjQZ4iR4G_EjhL7oRgju-fdY,15
35
- svg_ultralight-0.45.4.dist-info/RECORD,,
32
+ svg_ultralight-0.45.5.dist-info/METADATA,sha256=Nen5S_7cPJWIcbZCyrQGuvqkADk1g6-D7HsBmfiso7I,9052
33
+ svg_ultralight-0.45.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ svg_ultralight-0.45.5.dist-info/top_level.txt,sha256=se-6yqM_0Yg5orJKvKWdjQZ4iR4G_EjhL7oRgju-fdY,15
35
+ svg_ultralight-0.45.5.dist-info/RECORD,,