RawGen: Learning Camera Raw Image Generation

Dongyoung Kim, Junyong Lee, Abhijith Punnappurath, Mahmoud Afifi, Sangmin Han, Alex Levinshtein, Michael S. BrownarXiv 2026

TL;DR

RawGen is the first diffusion-based framework capable of generating physically consistent, linear camera raw images from either text prompts or standard sRGB images for any arbitrary camera model. By mapping diverse, unknown "photo-finishing" styles back to a canonical, device-independent linear space, it effectively unprocesses sRGB data to alleviate the massive data scarcity bottleneck in low-level computer vision.

What Problem Does This Paper Address?

Low-level vision tasks—such as denoising, illuminant estimation, and neural Image Signal Processor (ISP) learning—rely heavily on camera raw data because it preserves the physical, linear radiometry of a scene. However, large-scale raw datasets are notoriously difficult and expensive to collect, and they are inherently tied to specific camera hardware.

While modern generative models (like Stable Diffusion or FLUX) can synthesize an endless variety of high-quality images, they operate strictly in the 8-bit sRGB domain. These images have already been heavily processed by non-linear, proprietary camera ISPs (applying gamma correction, tone mapping, and color styling), which destroys the underlying physical linearity. Existing "inverse-ISP" methods try to undo this processing, but they typically assume a single, fixed ISP pipeline. They fail completely when applied to the diverse, unknown photo-finishing styles found across internet images or generative model outputs.

Methods

RawGen bridges this gap by decoupling content synthesis from camera-specific rendering. It introduces a two-stage framework built on top of a pretrained rectified-flow Diffusion Transformer (DiT), specifically FLUX.1-Kontext.

Fig. 2: Overview of the RawGen framework. During training, raw images are converted to CIE XYZ and sRGB representations to (A) fine-tune the DiT to denoise CIE XYZ latents conditioned on an sRGB image, and (B) fine-tune the VAE decoder to recon- struct CIE XYZ images. During inference (C), either an sRGB image (image-to-raw, I2R) or a text prompt (text-to-raw, T2R) is used to condition the DiT to generate a CIE XYZ latent, which is decoded to obtain a CIE XYZ image and subsequently mapped to the target camera’s raw space using its calibration metadata, which can be easily acquired from a single DNG file of target camera.

1. Many-to-One Training Data Construction

To make the model robust to any post-processing style, the authors created a dataset where multiple distinct sRGB renderings of the same scene are anchored to a single, shared CIE XYZ linear image. They randomized white balance, tone mapping curves, and contrast parameters to simulate a vast array of heterogeneous ISP behaviors.

2. Two-Stage Fine-Tuning

  • Denoiser Fine-Tuning (A): The DiT is fine-tuned via LoRA (rank=64) to denoise a corrupted CIE XYZ latent, conditioned on one of the randomized sRGB variants. This forces the denoiser to strip away the "style" and reconstruct the underlying linear structure.
  • Decoder Fine-Tuning (B): Because standard VAE decoders are optimized to output sRGB, the authors fine-tuned the VAE decoder ($D_{\text{VAE}}$) to accurately reconstruct linear CIE XYZ pixel values from the latent space.

3. Inference Phase (C)

RawGen supports two modes:

  • Image-to-Raw (I2R): Converts an existing sRGB image into its linear raw counterpart.
  • Text-to-Raw (T2R): Uses a text prompt to generate an sRGB latent, which is then unprocessed into a CIE XYZ image.

Finally, the canonical CIE XYZ output is deterministically mapped to any target camera's raw space using standard DNG calibration metadata and a chosen correlated color temperature (CCT). Optional sensor noise simulation and color filter array (CFA) re-mosaicing can be applied at the very end.

Datasets

The model was trained and evaluated using several key datasets:

  • MIT-Adobe FiveK & RAISE: Used for large-scale raw DNG images to construct the many-to-one training pairs.
  • NUS-8 Dataset: A nine-camera dataset used to evaluate downstream performance on illuminant estimation.
  • Nighttime Dataset: Used to evaluate raw-domain denoising and neural ISP learning.

Key Insights and Ideas

  • The Power of the Canonical Anchor: Instead of trying to learn a direct mapping from a specific sRGB style to a specific camera raw space, RawGen targets CIE XYZ as an intermediate, device-independent anchor. This makes the generation architecture completely camera-agnostic.
  • Learning Style Invariance: By training the model to map multiple differently edited versions of the same scene to the exact same linear target, the network learns to treat photo-finishing as "noise" that needs to be suppressed, preserving only the semantic content and physical structure.
  • Unlocking Generative Priors: Rather than training a raw diffusion model from scratch—which would fail due to the lack of massive raw datasets—RawGen successfully adapts the rich semantic priors of a large-scale sRGB model to output physically meaningful linear data.

Key Results

  • Superior Inversion Accuracy: When tested on expert-retouched variations from the MIT-Adobe FiveK dataset, RawGen outperformed existing state-of-the-art inverse-ISP methods (like CIE XYZ Net and InvISP) by 3 to 4 dB PSNR, demonstrating remarkable robustness to unseen editing styles.
  • Downstream Task Boosting: Using RawGen's Text-to-Raw pipeline to synthesize 3,000 synthetic training images significantly improved performance on downstream tasks. For instance, in illuminant estimation on the NUS-8 dataset, a model trained on RawGen data achieved a mean angular error of 3.14, drastically outperforming prior graphics-based synthesis methods (4.21) and approaching the performance of models trained on real data (3.02).
Fig. 1: We present RawGen, a diffusion-based method for generating realistic camera raw images. RawGen produces a latent representation of linear CIE XYZ images, con- ditioned on an sRGB image or a text prompt. The latent is decoded to CIE XYZ and mapped to arbitrary target camera raw spaces.

Limitations and Future Work

While RawGen excels at color and linear reconstruction, its final device-specific mapping relies on simplified physical assumptions. It currently uses a basic heteroscedastic Gaussian noise model and does not account for complex hardware artifacts like lens shading, optical blur, or point spread functions (PSFs). The authors note that future work will focus on conditioning the generative process directly on these device-specific physical priors to achieve even higher sensor fidelity.

Summary updated

BibTeX
@misc{kim2026rawgen,
  author = {Dongyoung Kim and Junyong Lee and Abhijith Punnappurath and Mahmoud Afifi and Sangmin Han and Alex Levinshtein and Michael S. Brown},
  title = {{RawGen: Learning Camera Raw Image Generation}},
  year = {2026},
  eprint = {2604.00093},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.00093},
}
Figure