Skip to content
Quasar Tools Logo

Can You Convert JPEG to RAW? The Truth Explained

Can you convert JPEG to RAW? Yes — but not in the way photographers mean. Learn what actually happens, when it is useful, and what your real alternatives are.

DH
Tutorials & How-Tos13 min read2,700 words

The short answer to "can you convert JPEG to RAW?" is: technically yes, practically no — not in the way most photographers mean it. A converted file will have a .raw extension and contain uncompressed pixel data, but it will never recover the information JPEG discarded when it was first created. This guide explains exactly what happens when you convert JPEG to RAW, what you actually get, when it is useful, and what your real alternatives are.

~75%JPEG data loss vs RAWTypical compression ratio
8-bitJPEG colour depthRAW stores 12–14 bits
0Lost data recoverableOnce JPEG is saved

What RAW format actually is

Camera RAW is not a single file format — it is a category of formats that store the unprocessed, uncompressed sensor data captured by a camera's image sensor before any in-camera processing occurs. Formats like Canon's CR2/CR3, Nikon's NEF, Sony's ARW, Fujifilm's RAF, and Olympus's ORF are all RAW formats. Adobe's DNG is a vendor-neutral RAW standard. What they share is that they record raw light measurements at 12 or 14 bits per channel — far more data than JPEG's 8 bits per channel.

When a camera shoots in RAW mode, the sensor data is saved directly to the card with minimal in-camera processing. When a camera shoots JPEG, it processes the RAW sensor data, applies white balance, sharpening, noise reduction, and colour corrections, then compresses the result using lossy JPEG compression and discards the original sensor data. That discarded data is gone permanently — it exists nowhere on the card or in the file.

What RAW data contains that JPEG does not

  • Extended dynamic range — RAW files capture 12–14 bits per channel, giving 4,096–16,384 tonal values per channel. JPEG captures 8 bits: 256 values per channel.
  • Non-destructive white balance — RAW records the raw sensor data; white balance is applied in post without degrading the image. JPEG bakes the white balance into the pixels permanently.
  • Recoverable highlights and shadows — RAW can recover 2–4 stops of over- or under-exposure in post-processing. JPEG clipping is permanent.
  • No generation loss — editing and re-saving RAW (exported as TIFF or DNG) does not degrade the image. Each JPEG save re-compresses and introduces additional artefacts.
  • Full colour data — camera sensors record one colour channel per pixel (Bayer pattern); RAW contains the raw Bayer data. JPEG has already had demosaicing applied.

Note

The term "RAW file" in the context of software tools like game engines, image processing pipelines, and graphics programs refers to something different: a plain binary file containing sequential pixel values (RGB or RGBA bytes) with no header. This is not camera RAW — it is an unformatted pixel buffer. The [JPG to RAW converter](/tools/image/converters/jpg-to-raw) on Quasar Tools produces this type of raw pixel data, not camera RAW sensor data.

Can you really convert JPEG to RAW?

Yes — in a technical, file-format sense. You can take the pixel data stored in a JPEG file and write it to a file in a raw binary format. The output will have a `.raw` extension (or `.dng`, if you use Adobe DNG Converter) and will be recognised as a RAW file by software that reads raw pixel buffers. The conversion is real and the file is genuinely different from the JPEG.

What you cannot do is restore the data that JPEG discarded. The conversion captures the 8-bit per channel pixel values that survived JPEG compression — nothing more. You are repackaging existing data into a different container. The bit depth stays at 8 bits; the dynamic range stays compressed; the JPEG artefacts, the lost highlight detail, and the baked-in colour processing remain exactly as they were. The resulting RAW file is simply a larger file with the same image quality.

You cannot add information that was never captured. Converting JPEG to RAW changes the container, not the content.

Image processing principle

JPEG to RAW as a lossless re-encoding

The most accurate description of the conversion is lossless re-encoding: the pixel values from the JPEG are copied exactly into the RAW format without further compression or quality loss. No additional data is lost in the conversion itself — but the data that was lost when the camera originally saved the JPEG cannot be recovered. Think of it like transcribing a photocopy of a document: the transcription is accurate, but it still only contains what was on the photocopy, not what was on the original.

Warning

Software that claims to "convert JPEG to RAW and recover dynamic range" is misleading. No algorithm can reconstruct highlight and shadow detail that was clipped during JPEG compression from the JPEG file alone. AI upscaling and HDR reconstruction tools can hallucinate plausible detail, but they are generating new data, not recovering original data. Treat those outputs as artistic interpretations, not photographic records.

When converting JPEG to RAW pixel data is actually useful

The conversion is genuinely useful in several technical contexts that have nothing to do with photography workflow. These use cases require a raw binary pixel buffer as input — the format produced by the JPG to RAW converter on Quasar Tools — not camera RAW sensor data.

1

Image processing and computer vision pipelines

Computer vision algorithms, image processing libraries (OpenCV, PIL/Pillow, libpng), and machine learning pipelines often work directly with raw pixel buffers rather than encoded image files. Converting JPEG to a raw binary format strips the file header and encoding overhead, giving direct access to the RGB or RGBA byte sequence. This is faster to read and process than parsing a JPEG stream.

2

Game engine texture pipelines

Some game engines and graphics frameworks accept raw pixel data as a texture source. Converting JPEG to RAW with a specific bit depth (typically 24-bit RGB or 32-bit RGBA) produces a texture buffer that can be loaded directly into GPU memory without an intermediary decode step. This is common in embedded systems, custom game engines, and graphics demos.

3

Firmware and embedded display systems

Microcontrollers and embedded displays — LCD panels, e-paper screens, LED matrices — typically cannot decode JPEG on-device due to computational constraints. Converting images to raw pixel arrays in advance (often at a reduced resolution like 64×64) allows the display to load and render the image without decoding. The JPG to RAW converter supports custom bit depths (8, 16, 24, or 32-bit) to match the target display's colour format.

4

Academic and research workflows

Research involving pixel-level image analysis sometimes requires the raw numerical pixel values without any format encoding. Converting to a raw binary format makes the pixel array directly readable by NumPy, MATLAB, or any language with binary file I/O — no image library required. The file is simply a flat array of integers in row-major order.

JPG to RAW Converter

Convert any JPG or JPEG image to a raw pixel binary file at 8, 16, 24, or 32-bit depth — entirely in your browser with no upload required.

Open tool

JPEG vs RAW: what you actually get from each

The choice between JPEG and RAW should be made at capture time, not in post-processing. Understanding the concrete differences helps set expectations about what is and is not recoverable after the fact.

AttributeCamera RAWJPEG
Bit depth12–14 bits/channel8 bits/channel
Tonal values4,096–16,384 per channel256 per channel
Compression✗ None (lossless)✓ Lossy (8:1 to 20:1 typical)
File size15–50 MB typical3–8 MB typical
White balanceAdjustable non-destructivelyBaked in permanently
Dynamic rangeFull sensor rangeCompressed to 8-bit range
Highlight recovery2–4 stops recoverable✗ Clipped data unrecoverable
Editing headroomHigh — no generation lossLow — re-saving adds artefacts
CompatibilityRequires RAW processorUniversal

The one-way nature of JPEG compression

JPEG compression is irreversible by design. The algorithm applies a Discrete Cosine Transform (DCT) to 8×8 pixel blocks, quantises the frequency coefficients (discarding high-frequency detail based on a quality setting), and Huffman-encodes the result. The discarded coefficients exist only in the compression step — they are not stored anywhere in the JPEG file and cannot be recovered by any means. This is fundamentally different from a lossless format like PNG or TIFF, where the original pixel values are always recoverable from the file.

Tip

If you are shooting images you plan to edit significantly, always shoot in RAW mode if your camera supports it. The cost is larger file sizes; the benefit is full dynamic range, white balance flexibility, and the ability to correct exposure errors that would be irreversible in JPEG. For casual photography where you do not plan to edit, JPEG is the practical choice.

Better alternatives to converting JPEG to RAW

If your goal is higher image quality or more editing flexibility from a JPEG, the answer is not to convert it to RAW — it is to work with the JPEG correctly, or to capture in RAW from the start. Here are the alternatives worth considering depending on your actual use case.

For editing: use TIFF or PSD as the working format

When editing a JPEG in Lightroom, Photoshop, or any professional editor, export to TIFF or PSD rather than saving back as JPEG. This preserves the pixel values through editing rounds without re-compression artefacts. TIFF is 8-bit by default (matching the JPEG source) but lossless — each save does not degrade the image. You are not recovering lost data, but you are preventing further loss from repeated JPEG re-compression.

For colour accuracy: convert to PNG

PNG uses lossless compression and preserves every pixel value exactly. Converting a JPEG to PNG via a tool like PNG Converter (in reverse) or any image editor produces a file where further edits do not introduce artefacts. PNG is significantly larger than JPEG but smaller than TIFF or RAW. For web workflows, converting once to PNG and editing from there avoids the compounding quality loss of multiple JPEG saves.

For smaller files: compress the JPEG properly first

If the goal is reducing file size rather than improving quality, compressing the JPEG is more effective than converting to RAW and back. The JPEG Compressor on Quasar Tools reduces JPEG file size with an adjustable quality slider and shows the exact KB saved and compression ratio before you commit to the output. A quality setting of 80–85 is typically indistinguishable from a quality-100 image at roughly half the file size.


For comparing format options

If you are deciding which format to use for a specific image — JPEG, PNG, WebP, AVIF, or GIF — the Image Format Comparison tool shows your image compressed in all five formats simultaneously with size and quality compared side by side. This is the fastest way to make a data-driven format decision for any specific image.

Image Format Comparison

Upload one image and see its compressed size across JPEG, PNG, WebP, AVIF, and GIF simultaneously — with a quality slider to find the optimal format and setting.

Open tool

How to convert JPG to RAW (the pixel buffer format)

If you need raw pixel data — for a computer vision project, a game engine texture, an embedded display, or any other technical workflow that requires direct byte access to pixel values — here is the exact process using the Quasar Tools converter.

  1. Open the JPG to RAW Converter — navigate to /tools/image/converters/jpg-to-raw. No account or signup is required.
  2. Upload your JPG or JPEG file — drag and drop or click to browse. The image is loaded entirely in your browser; it is never sent to a server.
  3. Select the bit depth — choose 8-bit (grayscale), 16-bit (high-precision grayscale), 24-bit (RGB colour), or 32-bit (RGBA with alpha channel) based on your target application.
  4. Convert and download — the tool processes the image and produces a raw binary file containing the pixel data in the selected format, ready to download.
  5. Use in your pipeline — load the raw binary file into your application using direct file I/O: each pixel is stored sequentially in row-major order with the number of bytes per pixel matching the selected bit depth.

Reading raw pixel data in common languages

A 24-bit RGB raw file at 800×600 pixels is exactly `800 × 600 × 3 = 1,440,000` bytes. The first three bytes are the R, G, B values of the top-left pixel; the next three bytes are the second pixel in the top row; and so on. In Python, `numpy.fromfile('image.raw', dtype=numpy.uint8).reshape(600, 800, 3)` loads this directly into a usable array without any image library. In C, read the file into a `unsigned char` buffer of the correct size and index pixels as `buffer[(y * width + x) * 3 + channel]`.

Note

If you are working with camera RAW formats — CR2, NEF, ARW, DNG, RAF, ORF — and need to compress or convert them, the [RAW Image Compressor](/tools/image/optimizers/raw-image-compressor) on Quasar Tools compresses actual camera RAW files to JPEG or WebP directly in your browser. This is the correct tool for photography workflows rather than the JPG to RAW pixel buffer converter.

Key takeaways

  • Converting JPEG to RAW repackages the existing pixel data into a raw binary format — it does not recover the dynamic range, bit depth, or detail that JPEG compression discarded at capture time.
  • JPEG stores 8 bits per channel (256 tonal values); camera RAW stores 12–14 bits per channel (4,096–16,384 values) — this gap cannot be bridged after the JPEG is saved.
  • The conversion is genuinely useful for technical workflows: computer vision pipelines, game engine textures, embedded displays, and any application that requires direct pixel buffer access.
  • The JPG to RAW Converter on Quasar Tools produces a raw binary pixel file at 8, 16, 24, or 32-bit depth — entirely in your browser with no upload.
  • For editing workflows, convert JPEG to TIFF or PNG instead — these lossless formats prevent re-compression artefacts without changing the underlying pixel quality.
  • If you need actual camera RAW capabilities, the only solution is to shoot in RAW mode — post-capture conversion from JPEG cannot recreate what the camera's sensor originally captured.
  • Use the Image Format Comparison tool to find the optimal format and compression setting for any specific image before committing to a conversion.

Frequently Asked Questions

No. Converting JPEG to RAW does not recover any image quality. JPEG compression discards data permanently — the high-frequency detail, extended tonal range, and highlight/shadow information that camera RAW contains are gone from the moment the JPEG is saved. A converted RAW file contains exactly the same 8-bit pixel values as the JPEG, just stored in a different file format. No conversion, algorithm, or AI tool can recover data that was never stored in the source file.

Converting JPEG to RAW produces a raw binary pixel buffer — a flat file containing the sequential RGB (or RGBA) byte values of every pixel in the image. This is not camera RAW sensor data; it is an unformatted pixel array. The output is useful for software that needs direct pixel access: computer vision libraries, game engine texture pipelines, embedded display systems, and academic image processing. It is larger than the source JPEG and contains no more image information.

Use the JPG to RAW Converter on Quasar Tools at /tools/image/converters/jpg-to-raw. Upload your JPG file, select the bit depth (8, 16, 24, or 32-bit), and download the raw binary output. The conversion runs entirely in your browser — no upload, no account, no cost. The output is a raw pixel buffer suitable for software pipelines, not a camera RAW file. The entire process takes under ten seconds for a typical JPEG.

The conversion itself is lossless — the pixel values from the JPEG are copied exactly into the raw binary format without any additional compression or quality reduction. However, the JPEG source already contains permanent lossy compression from when it was originally saved. The raw file output is an exact copy of the JPEG pixel data, not a restoration of any pre-JPEG quality level. Converting back to JPEG from the raw file will produce the same image as the original JPEG.

Camera RAW (CR2, NEF, ARW, DNG, RAF, etc.) is the unprocessed sensor data from a digital camera, recorded at 12–14 bits per channel with full dynamic range. Raw pixel data is an unformatted binary file containing processed RGB pixel values, typically 8 bits per channel. Camera RAW requires a RAW processor to decode; raw pixel data can be read directly with binary file I/O. Converting JPEG produces raw pixel data — it cannot produce camera RAW because the sensor data was never in the JPEG.

Shoot RAW whenever you plan to edit your images significantly in post-processing. RAW gives you 12–14 bits of tonal data per channel, recoverable highlights and shadows, non-destructive white balance adjustment, and full editing headroom without generation loss. Shoot JPEG for convenience when you do not plan to edit heavily — the files are smaller, universally compatible, and ready to share immediately. Once a JPEG is saved, it cannot be converted back to RAW quality, so the decision must be made at capture time.

No tool can recover data that was discarded during JPEG compression. AI upscaling tools can generate plausible-looking detail at higher resolutions, and AI denoising can reduce visible JPEG artefacts, but these tools create new data based on statistical patterns — they are not recovering original capture data. The output looks better aesthetically but is not a photographic record of what the camera actually saw. For accurate recovery of original image data, only the original RAW file from the camera contains that information.

The best alternative depends on your goal. For editing without generation loss, convert your JPEG to TIFF or PNG — both are lossless and preserve pixel values through multiple edit rounds. For reducing file size, use the JPEG Compressor to reduce size while staying in JPEG format. For comparing format options for a specific image, use the Image Format Comparison tool to see JPEG, PNG, WebP, AVIF, and GIF sizes side by side. For actual RAW quality, the only solution is to shoot RAW on a camera — no post-capture process can substitute for original sensor data.

ShareXLinkedIn

Related articles