Skip to main content

Image

Images are first class citizens in the Zef type system.

Loading an Image from File

file_location = 'Users/yolandi/zef/mastering_pip.jpg'  
image = (file_location
| load_file # creates a wish ("effect")
| run # execute the effect
| get['content'] # the return dict contains the image
| collect # trigger evaluation
)

What Type is It?

zef_type(image)      # => Image  

Which Image Formats are Supported?

Currently

  • jpg
  • png
  • svg
  • gif

Displaying images

When using iPython in VSCode interactive mode or Jupyter, Zef will show the actual image

image  

Can I work with images like with other values?

Yes, you can

  • store them on a graph (DB)
  • assign them to variables
  • use them in composing data structures
  • push them into a stream

Saving Images to a File

(image   
| save_file['Users/yolandi/important/todo.png'] # create wish
| run # execute the effect
)