Skip to main content

Load image

Prepare the image file for signing by reading its content into memory.  

Inputs

Image file path – Location of the image you want to sign.

Process

  1. Open the image file in binary mode.

  2. Read its contents into memory as a byte stream.

  3. This in-memory byte data is used by the signing process along with the manifest.

Output

A byte representation of the image (img_bytes) that is ready to be signed and combined with the manifest.

Python example

# This Python script reads an image file specified by the user and prints its raw 
#...bytes into the console.      

# load_image_demo.py  
import os   
 
def main():      
    # Ask user for image path      
    image_path = input("Enter the image file path: ").strip()        

    # Check if file exists      
    if not os.path.isfile(image_path):          
        print(f"❌ File not found: {image_path}")          
        return        

    # Read image in binary mode      
    with open(image_path, "rb") as f:  
    img_bytes = f.read()        

    # Print the byte content      
    print("\n=== Image Bytes ===\n")      
    print(img_bytes)    

if __name__ == "__main__":      
    main()