A method for carrying out a step of extracting a portion of a
predetermined size from the image data, and a step of preparing a
predetermined number of compressed partial data compressed with different
compression parameter values by repeating preparation of compressed
partial data by compressing the partial data in predetermined format for
the predetermined number of times with the compression parameter value
used in the predetermined format changed for each compression, on the
entire image data. The method also calculates the total of the data sizes
of all of the compressed partial data compressed with the same
compression parameter value for each of the compression parameter values
and prepares the compressed image data file from compressed partial data
compressed with a compression parameter value for which the total is not
larger than a given threshold and which is the closest value to the
threshold.