Repository navigation
Description
Summary
On main at 25ef65c, two Nikon NEF layouts decode but give wrong pixels (geometry), and a third stays preview-only without an open PR that covers it. I found all three in a compatibility sweep of the CC0 raw.pixls.us files for every maker except Sony, which covered all 91 Nikon bodies with CC0 files on the site.
1. D1X: pixels twice as tall as wide, rendered as if square
| Value | |
|---|---|
| File | raw.pixls.us 1786 (12-bit uncompressed) |
| Sensor data | 4028 x 1324, developed 4024 x 1324 |
Render at --size 1200 |
1200 x 395, aspect 3.04 |
| Camera preview in the file | 570 x 375, aspect 1.52 (the camera's own JPEGs are 3008 x 2000) |
| Against the preview | luminance correlation 0.20, ΔE76 27.1. The look fit is rejected because the frames don't match. |
The D1X photosites are rectangular, so its 1324 rows cover a 3:2 picture. LightCraft has no notion of a pixel aspect ratio. The DNG DefaultScale tag exists as a constant (crates/tiff/src/tags.rs:118) but nothing reads it, so DNGs with non-square pixels would be affected too. The compressed D1X NEF stays refused as Huffman-coded (see #671), so only uncompressed D1X files reach this.
Suggested fix (not cheap): give RawImage a pixel aspect, set to 2:1 vertical for the D1X and taken from DefaultScale for DNG. Then have the develop step resample after demosaicing, so the developed size becomes about 4024 x 2648. A per-model special case in the NEF decoder would also work, but it can't simply duplicate mosaic rows without breaking the CFA.
2. Coolpix E8800: the E8400's two-field layout, not covered by #672
| Value | |
|---|---|
| File | raw.pixls.us 2769 |
| Sensor data | 3280 x 2454, 12-bit, the same size as the E8400 |
| Render | two squashed copies of the scene, one above the other: the top field brownish, the bottom one blue and noisy |
| Against the camera JPEG | luminance correlation 0.21, ΔE76 32.0, fit rejected; no as-shot white balance read |
#672 (open) decodes the E5700 (CYGM) and E8400 two-field NEFs. Its branch matches "only these two models, at exactly these sizes and 0x828e patterns", so the E8800 keeps the stacked-field decode. #1045 (open) records the E5700, E8400 and E8800 as unsupported in evidence.tsv.
Suggested fix (cheap, under 2 hours, on top of #672): measure the E8800's field order and CFA on the CC0 file with #672's hue-correlation check. If they match the E8400's, add the model to #672's list.
3. Coolpix P330, P7700 and P7800 NRW: 12-bit samples in 16-bit words under compression 34713, not in #671's groups
These three bodies' CC0 NRWs (912, 5495, 1425) open preview-only with "Nikon compressed NEF without a linearization table (maker note 0x96)". This is a preview-only fallback.
- On the P7700 the raw SubIFD is 4032 x 3024, 12 bits, compression 34713, CFA RGGB, one strip of 24,385,536 bytes. That is exactly 4032 x 3024 x 2, so one 16-bit word per sample. ExifTool's NEFCompression reads "Unpacked 12 bits".
- LR-IMP-FORMATS: decode table-less Nikon 34713 NEFs stored as packed 12/14-bit data #671 (open) decodes table-less 34713 NEFs when the strip size matches one of its measured formulas: groups A to C (12- and 14-bit bit streams) and group E (D100 chunks). None of them is 16-bit words, so these three keep the refusal. LR-IMP-CAMERA-COVERAGE: verify 117 Nikon and Fujifilm bodies on CC0 files #1045 lists them under the LR-IMP-FORMATS: decode table-less Nikon 34713 NEFs stored as packed 12/14-bit data #671 family.
Suggested fix (cheap, under 2 hours, on top of #671): add a group for StripByteCounts == width × height × 2, read as 16-bit words in the file's byte order. Check the byte order and the value range (at most 4095) on the three CC0 files, and check the green against each camera JPEG as #671 does.
Reproduce
curl -sSLo d1x.nef 'https://raw.pixls.us/getfile.php/1786/nice/Nikon%20-%20D1X%20-%2012bit%2012bit%20uncompressed%20(3.0422960725076).NEF' && lightcraft-cli render d1x.nef -o d1x.jpg --size 1200
curl -sSLo e8800.nef 'https://raw.pixls.us/getfile.php/2769/nice/Nikon%20-%20Coolpix%20E8800%20-%2012bit%2012bit%20uncompressed%20(4:3).NEF' && lightcraft-cli render e8800.nef -o e8800.jpg --size 1200
- D1X expected: about 3:2. Actual: 1200 x 395.
- E8800 expected: one picture. Actual: two stacked half-height copies.
Related
- docs: parity checklist row for two-field Coolpix NEFs (E5400, E5700 CYGM, E8400, E8800); decoder is craft-libs #2235 #672 (open): E5700 and E8400.
- LR-IMP-CAMERA-COVERAGE: verify 117 Nikon and Fujifilm bodies on CC0 files #1045 (open): evidence rows for the three Coolpix bodies.
- LR-IMP-FORMATS: decode table-less Nikon 34713 NEFs stored as packed 12/14-bit data #671 (open): D1X compressed stays refused.
Activity
radialmonster commentedon Oct 13, 2026
The E8800 two-field decode (point 2) is now covered by #672, which detects the stacked-field layout from the image data. The same change also fixes the E5400, E5700 and E8400. The D1X aspect and the compressed P330/P7700/P7800 NRWs are not part of it.
radialmonster commentedon Oct 13, 2026
The D1X aspect (point 1) is now covered by #1475. It reads the pixel aspect from the raw IFD's X/Y resolution and stretches the rows, so the uncompressed D1X sample now renders 3:2 (4024x2648). The compressed D1X sample and the compressed P330/P7700/P7800 NRWs are still preview-only.
radialmonster commentedon Oct 28, 2026
The D1X aspect (point 1) is only partly fixed. #1475 reads the pixel shape from the raw SubIFD's X/Y resolution, which works when the camera writes 600 / 300. A D1X NEF on firmware Ver.1.01 (uncompressed, 4028x1324) writes 600 / 600 there instead, so the ratio check returns 1.0 and the picture still comes in squashed to about 3:1 on 0.14.0, 0.15.0 and main.
So the resolution tags alone aren't enough for every D1X/D1H. When they say square, the frame shape (4028x1324 raw against the camera's 3:2 picture) still shows the pixels are 2:1, and that's what a complete fix should fall back to.
radialmonster commentedon Oct 28, 2026
Details for anyone picking this up (line numbers on main 77c0a6a):
pixel_aspect_of()incrates/raw/src/vendor/nef.rs:185takes the raw SubIFD's XResolution / YResolution and accepts 1.5 to 4. On the Ver.1.01 file both are 600, so it returns 1.0. Everything after it (stretched_height()incrates/raw/src/lib.rs:471, the row resample after demosaic,developed_size()) already works once the aspect is right.Issue storytold#1274: the preview fallback applies only to frames ove…
Issue storytold#1274: pixel_aspect_of's doc says the preview fallback…
Issue storytold#1274: doc comments for the functions this pull reques…
Issue storytold#1274: merge main (preview candidates now take a budget)
radialmonster commentedon Nov 7, 2026
Update: the compressed P330, P7700 and P7800 NRWs are no longer preview-only. They decode from the sensor data since v0.12.0 (#671), and v0.19.0 still does. Their strip turned out to be plain big-endian 16-bit words, exactly 2 x width x height bytes (
be16_layout()incrates/raw/src/vendor/nef.rs, line 407 on main and v0.19.0).Still open here:
Issue storytold#1274: merge main (TIFF parsing moved to craft_tiff)
5.3: Transform's Upright row: Guided Upright icon, active mode named,…