A computer-implemented method of preprocessing, prior to encoding with an external encoder, image data using a preprocessing network comprising a set of inter-connected learnable weights, the method comprising: receiving, at the preprocessing network, image data from one or more images; and processing the image data using the preprocessing network, by applying the weights of the preprocessing network to the image data, to generate an output pixel representation, of the one or more images, for encoding with the external encoder, wherein the preprocessing network is configured to take as an input encoder configuration data representing one or more configuration settings of the external encoder, wherein the weights of the preprocessing network are dependent upon the one or more configuration settings of the external encoder, wherein the weights of the preprocessing network are trained using end-to-end back-propagation of errors, wherein the errors are calculated using: a cost function indicative of an estimated image error associated with encoding the output pixel representation using the external encoder configured according to the one or more configuration settings, and a virtual codec module comprising one or more differentiable functions, the virtual codec module being configured to emulate the external encoder configured according to the one or more configuration settings, the virtual codec module being configured to receive outputs from the preprocessing network and receive the configuration data representing the one or more configuration settings of the external encoder. receiving, at the preprocessing network, image data from one or more images; and processing the image data using the preprocessing network, by applying the weights of the preprocessing network to the image data, to generate an output pixel representation, of the one or more images, for encoding with the external encoder, wherein the preprocessing network is configured to take as an input encoder configuration data representing one or more configuration settings of the external encoder, wherein the weights of the preprocessing network are dependent upon the one or more configuration settings of the external encoder, wherein the weights of the preprocessing network are trained using end-to-end back-propagation of errors, wherein the errors are calculated using: a cost function indicative of an estimated image error associated with encoding the output pixel representation using the external encoder configured according to the one or more configuration settings, and a virtual codec module comprising one or more differentiable functions, the virtual codec module being configured to emulate the external encoder configured according to the one or more configuration settings, the virtual codec module being configured to receive outputs from the preprocessing network and receive the configuration data representing the one or more configuration settings of the external encoder. a cost function indicative of an estimated image error associated with encoding the output pixel representation using the external encoder configured according to the one or more configuration settings, and a virtual codec module comprising one or more differentiable functions, the virtual codec module being configured to emulate the external encoder configured according to the one or more configuration settings, the virtual codec module being configured to receive outputs from the preprocessing network and receive the configuration data representing the one or more configuration settings of the external encoder.