A method performed on an imaging device (512-A, 512-B, 512-C, 512-D) for transcoding reference encoded image data into device-specific image data, the method comprising the steps of: determining a digital code mapping between a set of reference digital code values and a set of device-specific digital code values, wherein the set of reference digital code values is mapped in a reference mapping to a set of reference gray levels, and wherein the set of device-specific digital code values is mapped in a device-specific mapping to a set of device-specific gray levels; receiving reference encoded image data encoded with the set of reference digital code values, wherein luminance values in the reference encoded image data are based on the set of reference digital code values, wherein a luminance difference between two reference gray levels represented by two adjacent reference digital code values in the set of reference digital code values is inversely proportional to a peak contrast sensitivity of human vision adapted at a particular light level; and transcoding, based on the digital code mapping, the reference encoded image data encoded with the set of reference digital code values into device-specific image data encoded with the set of device-specific digital code values, wherein luminance values in the device-specific image data are based on the set of device-specific digital code values; characterized in that at least one of the reference mapping and the device-specific mapping is determined based at least in part on a functional model represented with the function L = D / m 1 − c 1 c 2 − c 3 D / m 1 / n 1 wherein D represents a digital code value to be mapped, L represents a gray level corresponding to the digital code value, n represents a slope in a middle section of a logD / logL curve as given by the function, m represents the sharpness of the knee of the logD / logL curve, and c 1, c 2 and c 3 define the end and middle points of the logD / logL curve. determining a digital code mapping between a set of reference digital code values and a set of device-specific digital code values, wherein the set of reference digital code values is mapped in a reference mapping to a set of reference gray levels, and wherein the set of device-specific digital code values is mapped in a device-specific mapping to a set of device-specific gray levels; receiving reference encoded image data encoded with the set of reference digital code values, wherein luminance values in the reference encoded image data are based on the set of reference digital code values, wherein a luminance difference between two reference gray levels represented by two adjacent reference digital code values in the set of reference digital code values is inversely proportional to a peak contrast sensitivity of human vision adapted at a particular light level; and transcoding, based on the digital code mapping, the reference encoded image data encoded with the set of reference digital code values into device-specific image data encoded with the set of device-specific digital code values, wherein luminance values in the device-specific image data are based on the set of device-specific digital code values;