A computer implemented method of compressing image data (104, 200) comprising: applying a discrete cosine transformation to each of a plurality of non-overlapping pixel blocks which span a frame of image data to generate a set of DCT coefficients for each pixel block comprising a DC DCT coefficient and a plurality of AC DCT coefficients; quantising each set of DCT coefficients to generate a set of quantised DC DCT coefficients and a set of quantised AC DCT coefficients; forming a DC array from the set of quantised DC DCT coefficients; forming an AC matrix from the set of quantised AC DCT coefficients; forming a limited data array comprising elements having values corresponding only to each unique value of the elements of the AC matrix; compressing the AC matrix by eliminating blocks of data of the AC matrix having only zero values, wherein each block of data has the same known fixed size, and forming a reduced AC array from blocks of data of the AC matrix including non-zero values; storing the position in the AC matrix of each block of data of the AC matrix including non-zero values in a location array; generating a key using the maximum value of the elements of the reduced AC array; compressing (368, 400) the reduced AC array using the key to form a coded AC array, wherein the key comprises a plurality of key components and the same number of elements of the reduced AC array as the number of key components are combined using the key to form a single element of the coded AC array; arithmetically coding the DC array and the coded AC array to form arithmetically coded data; and forming a compressed image file including the arithmetically coded data (436, 438, 440) and storing the location array in a header of the compressed image file, and storing the key and the limited data array. applying a discrete cosine transformation to each of a plurality of non-overlapping pixel blocks which span a frame of image data to generate a set of DCT coefficients for each pixel block comprising a DC DCT coefficient and a plurality of AC DCT coefficients; quantising each set of DCT coefficients to generate a set of quantised DC DCT coefficients and a set of quantised AC DCT coefficients; forming a DC array from the set of quantised DC DCT coefficients; forming an AC matrix from the set of quantised AC DCT coefficients; forming a limited data array comprising elements having values corresponding only to each unique value of the elements of the AC matrix; compressing the AC matrix by eliminating blocks of data of the AC matrix having only zero values, wherein each block of data has the same known fixed size, and forming a reduced AC array from blocks of data of the AC matrix including non-zero values; storing the position in the AC matrix of each block of data of the AC matrix including non-zero values in a location array; generating a key using the maximum value of the elements of the reduced AC array; compressing (368, 400) the reduced AC array using the key to form a coded AC array, wherein the key comprises a plurality of key components and the same number of elements of the reduced AC array as the number of key components are combined using the key to form a single element of the coded AC array; arithmetically coding the DC array and the coded AC array to form arithmetically coded data; and forming a compressed image file including the arithmetically coded data (436, 438, 440) and storing the location array in a header of the compressed image file, and storing the key and the limited data array.