A computer-implemented method for image processing by a device comprising an image sensor for capturing an image having a first bit depth, a capture mode controller configured to control the image sensor for image capture under a plurality of capture modes, an image signal processor configured to produce from an image captured by the image sensor, by applying a non-linear transformation and re-encoding, a non-linearized image, and an inverter configured to produce from an image produced by the image signal processor, by applying an inverse transformation and re-encoding, a re-linearized image, the method comprising: providing a plurality of non-linear transformations each associated with a different capture mode of the plurality of capture modes, controlling, by the capture mode controller, of the image sensor to capture an image under one of the capture modes, the image having sensor signals encoded at the first bit depth, communicating, by the capture mode controller, at least the one non-linear transformation associated with the capture mode under which the image was captured by the image sensor to the image signal processor, applying the one non-linear transformation to the captured image and re-encoding, by the image signal processor, to produce from the captured image a non-linearized image that has code values characterizing the sensor signals of the captured image non-linearly distributed across a second bit depth that is smaller than the first bit depth, wherein a relatively greater portion of the second bit depth is allocated to less noisy ranges of the sensor signals of the captured image and a relatively smaller portion of the second bit depth is allocated to more noisy ranges of the sensor signals of the captured image, providing a plurality of inverse transformations each inverse to a different non-linear transformation of the plurality of non-linear transformations, receiving from the image signal processor, by the inverter, the non-linearized image, receiving, from the capture mode controller, a capture-mode specification indicating the capture mode under which the captured image was captured by the image sensor, selecting, based upon the capture-mode specification, from the plurality of inverse transformations the one inverse transformation inverse to the one non-linear transformation used to produce the non-linearized image; and applying the one inverse transformation to the non-linearized image and re-encoding, by the inverter, to produce from the non-linearized image a re-linearized image that has code values characterizing the sensor signals of the captured image linearly distributed across a third bit depth greater than the second bit depth. providing a plurality of non-linear transformations each associated with a different capture mode of the plurality of capture modes, controlling, by the capture mode controller, of the image sensor to capture an image under one of the capture modes, the image having sensor signals encoded at the first bit depth, communicating, by the capture mode controller, at least the one non-linear transformation associated with the capture mode under which the image was captured by the image sensor to the image signal processor, applying the one non-linear transformation to the captured image and re-encoding, by the image signal processor, to produce from the captured image a non-linearized image that has code values characterizing the sensor signals of the captured image non-linearly distributed across a second bit depth that is smaller than the first bit depth, wherein a relatively greater portion of the second bit depth is allocated to less noisy ranges of the sensor signals of the captured image and a relatively smaller portion of the second bit depth is allocated to more noisy ranges of the sensor signals of the captured image, providing a plurality of inverse transformations each inverse to a different non-linear transformation of the plurality of non-linear transformations, receiving from the image signal processor, by the inverter, the non-linearized image, receiving, from the capture mode controller, a capture-mode specification indicating the capture mode under which the captured image was captured by the image sensor, selecting, based upon the capture-mode specification, from the plurality of inverse transformations the one inverse transformation inverse to the one non-linear transformation used to produce the non-linearized image; and applying the one inverse transformation to the non-linearized image and re-encoding, by the inverter, to produce from the non-linearized image a re-linearized image that has code values characterizing the sensor signals of the captured image linearly distributed across a third bit depth greater than the second bit depth.