Belval / TextRecognitionDataGenerator

A synthetic data generator for text recognition
MIT License
3.24k stars 966 forks source link

ValueError: height and width must be > 0 #277

Closed javohirss closed 2 years ago

javohirss commented 2 years ago
--> 130             )
    131             resized_img = distorted_img.resize(
--> 132                 (new_width, size - vertical_margin), Image.ANTIALIAS
    133             )
    134             resized_mask = distorted_mask.resize((new_width, size - vertical_margin), Image.NEAREST)

[/usr/local/lib/python3.7/dist-packages/PIL/Image.py](https://localhost:8080/#) in resize(self, size, resample, box, reducing_gap)
   1881         if self.mode in ["LA", "RGBA"]:
   1882             im = self.convert(self.mode[:-1] + "a")
-> 1883             im = im.resize(size, resample, box)
   1884             return im.convert(self.mode)
   1885 

[/usr/local/lib/python3.7/dist-packages/PIL/Image.py](https://localhost:8080/#) in resize(self, size, resample, box, reducing_gap)
   1903                 )
   1904 
-> 1905         return self._new(self.im.resize(size, resample, box))
   1906 
   1907     def reduce(self, factor, box=None):
ValueError: height and width must be > 0
SilvaQ commented 2 years ago

I also encountered this problem, the problem disappeared after setting the font, you can specify fonts dir to try

javohirss commented 2 years ago

Oh thx, now it works