Screenshot to RGB

Hello. Any solution?
When I write pil instead of pytorch (line19), it does not give an error, but the pil is slower. I want to use pytorch.

My Code


Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\1700x\AppData\Local\Programs\Python\Python38\lib\", line 932, in _bootstrap_inner
  File "C:\Users\1700x\AppData\Local\Programs\Python\Python38\lib\", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "F:\", line 89, in main
  File "F:\", line 33, in check4
    rgb = im.convert('RGB')
AttributeError: 'Tensor' object has no attribute 'convert'

PyTorch doesn’t provide any image decoding methods and torchvision uses PIL by default.
You could try to use OpenCV instead of PIL or alternatively PIL-SIMD, which might speedup your code.

1 Like