DNG 1.7 lossy: unable to open preview

*** Please report new bugs here! ***

Moderators: xnview, Dreamer

golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

DNG 1.7 lossy: unable to open preview

Post by golemus »

As there was at least 2 different bugs related to DNG 1.7 lossy. One (color issues of DNG 1.7 RAW data rendering) already has bug report. The other I mentioned in some thread but just to be sure its not disappeared in the middle I make a separate bug report of it (which can be reproduced with samples I provided previously)

Way to reproduce:

- have Settings - Formats - Read - Camera RAW - View set to Embedded preview
- open DNG 1.7 lossy file (e.g. from Adobe DNG converter) with XNView MP



Expected results:

- largest preview opens

Observer results:

- smaller preview (500-700 pixels wide maybe?) opens




Most likely explanation is that largest preview is JPEG XL image and smaller JPEG files are JPG files.

Probably there is issue opening the large preview as JXLs inside DNG are (at least from XNMPs view) still a new thing.
User avatar
xnview
Author of XnView
Posts: 48447
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: DNG 1.7 lossy: unable to open preview

Post by xnview »

please send us a sample file
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

xnview wrote: Wed Jul 15, 2026 6:21 am please send us a sample file
Here it is.

The files ending to ly.dng (FILENAME.ly.dng) are the DNG 1.7 files whose previews don't open.

https://nx76363.your-storageshare.de/s/MZiAbKDsda9bRK3
User avatar
xnview
Author of XnView
Posts: 48447
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: DNG 1.7 lossy: unable to open preview

Post by xnview »

Thanks, it seems that these DNG have only a small embedded preview
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

xnview wrote: Fri Jul 24, 2026 8:12 am Thanks, it seems that these DNG have only a small embedded preview
Hi. I think that is incorrect. I can extract .jxl preview from them with exiftool. Below is .bat file which I use to do it:

This command:
exiftool -preview:all -b -W %%d\%%f-EMBA%%-c.%%s "%INPUTFILE%"






------------------------------
@echo off
setlocal enabledelayedexpansion
::
::set "IFILE=%~1"
set "IFILE=%~dpnx1"


echo.
exiftool -preview:all -b -W %%d\%%f-EMBA%%-c.%%s "%IFILE%"
::call exiftool -preview:all -b -W %%%%d\%%%%f-EMBA%%%%-c.%%%%s "%IFILE%"

echo.
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

Try this:
exiftool -preview:subifd2:previewjxl -b -W %%d\%%f-EMBX%%-c.%%s "%IFILE%"




DNG files can contain multiple previews, e.g.

IMG_1665.ly.dng

RAW image (approximately 3882 x 2592 px)
3882 x 2592 jxl
256 x 171 jpg



P1000175.ly.dng:

RAW image (approximately 3776 x 2520 px)
3776 x 2520 jxl
1920 x 1080 jpg
256 x 171 jpg
160 x 120 jpg



P1000175.ly.dng was created from .RW2 raw of Panasonic DMC-LX7 Lumix

Original RW2 had 1920px preview generated by the camera. I don't remember if it had the 256 x 171 and 160 x 120 previews.



So when you use Adobe DNG converter it typically generates its own new preview. How it treats the old existing preview might be unpredictable and sometimes it leaves it to the file beside the new preview and sometimes removes it.

Nevertheless it seems so mixed that IMO image viewer must act under the assumption that there can be multiple different previews inside DNG file and have some mechanism to choose the right one.


What makes this more difficult is that depending on source raw file and destination DNG file the preview might be saved to different places in DNG or at least need different flavours of exiftool command to extract them.



So I had to do like 5 different .bat files for extracting previews from with different flavour of commands.



0. with this you can extract all of them (I think):

1 And I think this worked at least quite often for extracting the JXL preview that XNMP had until now trouble showing
2 I don't remember that this was for but I had made this also as bat file.
3 This is from extracting 1920 "original" preview from some of the files
4 This I think is working most of the time for extracting the preview that was generated by Adobe DNG converter


0 exiftool -preview:all -b -W %%d\%%f-EMBA%%-c.%%s "%IFILE%"

1 exiftool -preview:subifd2:previewjxl -b -W %%d\%%f-EMBX%%-c.%%s "%IFILE%"
2 exiftool -preview:subifd2:jpgfromraw -b -W %%d\%%f-EMBD%%-c.%%s "%IFILE%"
3 exiftool -preview:jpgfromraw -b -W %%d\%%f-EMBO%%-c.%%s "%IFILE%"
4 exiftool -preview:previewimage -b -W %%d\%%f-EMBP%%-c.%%s "%IFILE%"
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

A bit offtopic, but I hate .bat files and am in process to translate all of them to something better like python or powershell. They are nightmare with filenames containing weird signs such as !, [, ], &, etc.. And also have weird bugs if you have extra spaces / comments inside for loops or if clauses. Dunno why AI recommended me to use them when I started doing this stuff...
User avatar
xnview
Author of XnView
Posts: 48447
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: DNG 1.7 lossy: unable to open preview

Post by xnview »

golemus wrote: Fri Jul 24, 2026 8:47 pm DNG files can contain multiple previews, e.g.
yes but libraw shows only 1 preview (256 x 171 jpg) for IMG_1665.ly.dng or P1000175.ly.dng :?
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

xnview wrote: Sun Jul 26, 2026 7:01 am
golemus wrote: Fri Jul 24, 2026 8:47 pm DNG files can contain multiple previews, e.g.
yes but libraw shows only 1 preview (256 x 171 jpg) for IMG_1665.ly.dng or P1000175.ly.dng :?
I did a bug report on it to Libraw github:

https://github.com/LibRaw/LibRaw/issues/841
golemus
Posts: 137
Joined: Mon Dec 23, 2024 8:35 am

Re: DNG 1.7 lossy: unable to open preview

Post by golemus »

xnview wrote: Sun Jul 26, 2026 7:01 am yes but libraw shows only 1 preview (256 x 171 jpg) for IMG_1665.ly.dng or P1000175.ly.dng :?
LibRaw user now replied in the Github bug report like this:


> To enable JPEG-XL previews please set LIBRAW_RAWOPTIONS_ALLOW_JPEGXL_PREVIEWS bit in imgdata.rawparams.options
> (not all apps/callers supports JPEG-XL, so it need to be enable explicitly)
> LibRaw uses largest (enabled) preview in unpack_thumb.
> Also one may use unpack_thumb_ex(N) to extract Nth thumbnail from thumb_list