Skip to content

Converts time to analog clock image, converts analog clock image to time

Notifications You must be signed in to change notification settings

ayalachn/ClockImageTimeConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ClockImageTimeConverter

Converts time to analog clock image, converts analog clock image to time.

Create analog clock

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:

image

Convert analog clock image to time

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:

image

Code:

converter = ClockImageTimeConverter()
hour_, minute_= converter.get_time_from_clock_image('images/H-4570.png')

Result:

image

Prequisites

  • 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

Sources:

About

Converts time to analog clock image, converts analog clock image to time

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages