Augmentor icon indicating copy to clipboard operation
Augmentor copied to clipboard

Cannot write mode

Open AKJDM opened this issue 7 years ago • 1 comments

Hello, I am trying to augment a small amount of images however i keep getting these errors.

any ideas?

see the below for errors

Processing <PIL.Image.Image image mode=RGB size=720x1280 at 0x11410B0F0>: 0%| | 4/1000 [00:05<22:02, 1.33s/ Samples] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/JpegImagePlugin.py", line 620, in _save rawmode = RAWMODE[im.mode] KeyError: 'P'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/roryhodgson/Desktop/Augmentor-master 3/Augmentor/Pipeline.py", line 246, in _execute images[i].save(os.path.join(augmentor_image.output_directory, save_name)) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/Image.py", line 1969, in save save_handler(self, fp, filename) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/JpegImagePlugin.py", line 622, in _save raise IOError("cannot write mode %s as JPEG" % im.mode) OSError: cannot write mode P as JPEG

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/roryhodgson/Desktop/Augmentor-master 3/wheels.py", line 21, in p.sample(num_of_samples) File "/Users/roryhodgson/Desktop/Augmentor-master 3/Augmentor/Pipeline.py", line 359, in sample for result in executor.map(self, augmentor_images): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 586, in result_iterator yield fs.pop().result() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 425, in result return self.__get_result() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result raise self._exception File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/Users/roryhodgson/Desktop/Augmentor-master 3/Augmentor/Pipeline.py", line 100, in call return self._execute(augmentor_image) File "/Users/roryhodgson/Desktop/Augmentor-master 3/Augmentor/Pipeline.py", line 263, in _execute print("Error writing %s, %s. Change save_format to PNG?" % (file_name, e.message)) AttributeError: 'OSError' object has no attribute 'message'

AKJDM avatar Dec 12 '18 07:12 AKJDM

Hi @AKJDM, are you perhaps working with PNGs that have an alpha channel? You could try setting the save file format to PNG so that they are not converted to JPEG on save.

mdbloice avatar Dec 17 '18 09:12 mdbloice