Converts time to analog clock image, converts analog clock image to time.
In order to create an analog clock image call the draw_analog_clock method that's in the ClockImageTimeConverter class. Usage example - create an analog clock that shows the time 10:15:
converter = ClockImageTimeConverter()
converter.draw_analog_clock(10, 15)
The default image type is PNG, other options can be JPG or TIF.
Example:
converter.draw_analog_clock(10, 15, "jpg")
Result:
Inorder to get the time shown in an analog clock image call the get_time_from_clock_image method that's in the ClockImageTimeConverter class.
converter = ClockImageTimeConverter()
hour, minutes = converter.get_time_from_clock_image('my_analog_clock.png')
Example: Let's get the time of this analog clock:
Code:
converter = ClockImageTimeConverter()
hour_, minute_= converter.get_time_from_clock_image('images/H-4570.png')
Result:
- No support for analog clock image with second hand at the moment.
- Install libraries used in this project (requirements.txt):
pip install -r requirements.txt