niljub / pic2stl

pic2stl is a Python package that converts images to 3D STL models.
MIT License
2 stars 0 forks source link

UnidentifiedImageError: cannot identify image file (for *.svg file) #1

Closed sugizo closed 3 months ago

sugizo commented 5 months ago

env google colab

code

!curl -LC - https://upload.wikimedia.org/wikipedia/commons/a/ae/Official_b.a.t.m.a.n._logo.svg -o batman.svg
file_name = 'batman'
image_to_stl('%s.svg' % file_name, '%s.stl' % file_name, extrusion_height = 3, add_base = True, base_thickness = 0)
files.download('%s.stl' % file_name)

result

UnidentifiedImageError                    Traceback (most recent call last)
[<ipython-input-67-1ca39a5d37f5>](https://localhost:8080/#) in <cell line: 3>()
      1 get_ipython().system('curl -LC - https://upload.wikimedia.org/wikipedia/commons/a/ae/Official_b.a.t.m.a.n._logo.svg -o batman.svg')
      2 file_name = 'batman'
----> 3 image_to_stl('%s.svg' % file_name, '%s.stl' % file_name, extrusion_height = 3, add_base = True, base_thickness = 0)
      4 files.download('%s.stl' % file_name)

1 frames
[/usr/local/lib/python3.10/dist-packages/PIL/Image.py](https://localhost:8080/#) in open(fp, mode, formats)
   3337         warnings.warn(message)
   3338     msg = "cannot identify image file %r" % (filename if filename else fp)
-> 3339     raise UnidentifiedImageError(msg)
   3340 
   3341 

UnidentifiedImageError: cannot identify image file '/content/batman.svg'

expected result can support *.svg file

best regards

niljub commented 3 months ago

Hi thanks for your report :)

I have fixed it with v10.0.8