JPEG-XR: Error reading AlphaOffset data in IFD0

Started by extest, April 01, 2020, 08:35:49 AM

Previous topic - Next topic

extest

Hello. I'm experiencing a problem with changing/fixing EXIF data for a JPEG-XR file (.jxr) with an alpha channel. I get an error:
Error reading AlphaOffset data in IFD0 - exif.jxr

OS is Ubuntu 18.04. Exiftool is 11.92.
I tried to fix the file with commands from the FAQ#20 and commands found in other threads, such as
exiftool -exif:all= -tagsfromfile @ -exif:all -thumbnailimage -unsafe exif.jxr
but sadly nothing worked and exiftool throws the very same error.
File looks to be valid (gets displayed properly with working transparency), is generated by JxrEncApp 1.1 (latest I guess) from TIFF file. JXR files without transparency generated in the same environment work fine with exiftool.

Exiftool reads this file without errors:
ExifTool Version Number         : 11.92
File Name                       : exif.jxr
Directory                       : .
File Size                       : 65 kB
File Modification Date/Time     : 2020:04:01 11:37:32+00:00
File Access Date/Time           : 2020:04:01 11:40:29+00:00
File Inode Change Date/Time     : 2020:04:01 11:37:35+00:00
File Permissions                : rw-r--r--
File Type                       : JXR
File Type Extension             : jxr
MIME Type                       : image/jxr
Exif Byte Order                 : Little-endian (Intel, II)
Pixel Format                    : 32-bit BGRA
Transformation                  : Horizontal (normal)
Image Width                     : 1260
Image Height                    : 780
Width Resolution                : 25.3999996185303
Height Resolution               : 25.3999996185303
Image Offset                    : 158
Image Byte Count                : 55418
Alpha Offset                    : 55576
Alpha Byte Count                : 66213
Image Size                      : 1260x780
Megapixels                      : 0.983


Both JXR and TIFF files are attached.
Is there a possible fix or workaround for this? Thanks.

Phil Harvey

Note that FAQ 20 says:

ExifTool may not be used like this to repair TIFF-based files [...]

Unfortunately this applies to JXR files.

The JXR file you posted has a significant problem (the alpha channel data is truncated -- it should be 66213 bytes long, but is truncated after only 10637 bytes), so ExifTool will not write this file for fear of further corruption.

The thing to do is to report this bug to JxrEncApp, and get the problem fixed there.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

extest

Thanks for the reply Phil.
Reaching developers doesn't seem to be possible, encoding cli tool was last updated by Microsoft in 2013 as far as I can understand.

I found a workaround by switching from default alpha channel format (planar) to interleaved ("-a 3" in command line). It generates a slightly different exif information as can be seen below, but file is still valid and has working transparency. Exiftool can perfectly work with it and modify exif data.

ExifTool Version Number         : 11.92
File Name                       : exif.jxr
Directory                       : /tmp
File Size                       : 63 kB
File Modification Date/Time     : 2020:04:02 15:32:16+00:00
File Access Date/Time           : 2020:04:02 15:32:16+00:00
File Inode Change Date/Time     : 2020:04:02 15:32:16+00:00
File Permissions                : rw-------
File Type                       : JXR
File Type Extension             : jxr
MIME Type                       : image/jxr
Exif Byte Order                 : Little-endian (Intel, II)
Pixel Format                    : 32-bit BGRA
Transformation                  : Horizontal (normal)
Image Width                     : 1260
Image Height                    : 780
Width Resolution                : 25.3999996185303
Height Resolution               : 25.3999996185303
Image Offset                    : 134
Image Byte Count                : 64640
Image Size                      : 1260x780
Megapixels                      : 0.983