Main Content

Write Image to Binary File

This example shows how to write an image data to a binary file in a custom format using the Write Binary File block.

Open the Simulink model.

modelname = 'ex_blkwritebinaryfile.slx';

The input to the model is a RGB color image. The model coverts the color image to grayscale using the Color Space Conversion block. The Conversion parameter of Color Space Conversion block is set to R'G'B to intensity. The output binary file name is specified in the File name parameter of the Write Binary File block as outputimage.bin. The parameters of the Write Binary File block are configured so the block outputs a custom binary file.

  • Video Format : Custom

  • Number of inputs : 1

  • Component order in binary file : 1

Simulate the model.


The model outputs a binary file named outputimage.bin to the MATLAB workspace. You can read this binary file using the Read Binary File block.