fookatchu / pyphotonfile

Library for reading and writing files for the Anycubic Photon 3D-Printer (.photon and .cbddlp)
GNU General Public License v3.0
24 stars 9 forks source link

Type error generated by PIL #17

Open hphilamore opened 4 years ago

hphilamore commented 4 years ago

Hi, I'm seeing the same issue as reported in a previous issue : Compatibility with Elegoo Mars? #8

I have a fresh virtual env, with python 3.7 and pyphotonfile installed according to your instructions.

When running the example script using a .photon file as the input, the following error is generated:

File "hemisphere.py", line 8, in photon.export_images("tempdir") File "//lib/python3.7/site-packages/pyphotonfile/photonfile.py", line 381, in export_images self.exportimage(sublayer, os.path.join(dirpath, '{:05d}{:02d}.png'.format(i, j))) File "//lib/python3.7/site-packages/pyphotonfile/photonfile.py", line 388, in export_image Image.fromarray(img).convert('RGB').save(filepath) File "/***/lib/python3.7/site-packages/PIL/Image.py", line 2716, in fromarray raise TypeError("Cannot handle this data type: %s, %s" % typekey) TypeError: Cannot handle this data type: (1, 1), <i8

On installing a previous version of pillow (v.5.2) the error instead appears as:

File "hemisphere.py", line 8, in photon.export_images("tempdir") File "//lib/python3.7/site-packages/pyphotonfile/photonfile.py", line 381, in export_images self.exportimage(sublayer, os.path.join(dirpath, '{:05d}{:02d}.png'.format(i, j))) File "//lib/python3.7/site-packages/pyphotonfile/photonfile.py", line 388, in export_image Image.fromarray(img).convert('RGB').save(filepath) File "/***/lib/python3.7/site-packages/PIL/Image.py", line 2463, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type

I'd really appreciate your help solving this issue. Many thanks.

fookatchu commented 4 years ago

Sorry for the late reply! Could you give the recent pull request a try and report back if this fixes your problem?