Skip to content

Data types

These pages document the value types Drafter defines for data that Python has no built-in representation for: images, camera results, locations, uploaded files, and sounds. All of them behave like ordinary Python values: you can store them in state, pass them to functions, and compare them in tests.

  • Picture: an image as a Python value. The page covers constructors, transformations, pixel access, and conversions. This is the type you are most likely to need.
  • Photo: the value a Camera passes to your route, combining a picture with a status.
  • Color: a color as red, green, blue, and alpha amounts, which is one of the forms a ColorPicker can pass to your route.
  • Location and map types: values that describe positions, used with Map and CurrentLocation.
  • File types: values for uploaded files that keep their filename and metadata, used with FileUpload.
  • Audio types: values for sound levels and recordings, used with the sound components.

All of these types follow the same pattern: a route receives a value by annotating a parameter with the type, and a page shows or plays a value through the matching component.