%% Write Image to Motion JPEG 2000 File
% Write an RGB image to a Motion JPEG 2000 file with lossless compression.
% Create an array containing data from the sample still image, peppers.png.

A = imread('peppers.png');

%
% Create a VideoWriter object for a new video file. Use the 'Archival' profile to specify a Motion JPEG 2000 file with lossless compression.

v = VideoWriter('myFile','Archival');

%
% Verify the type of video compression for the new file.

v.VideoCompressionMethod

%
% Open the video file for writing. Then, write the image data in A to the file.

open(v)
writeVideo(v,A)

%
% Close the video file.

close(v)

% Copyright 2015 The MathWorks, Inc.