[gdal-dev] Updating value for Compression tag for JPEGXL in TIFF to the one of DNG 1.7 ?
Kurt Schwehr
schwehr at gmail.com
Wed Jan 8 17:14:31 PST 2025
Here is the patch that I applied to my local //third_party/tiff copy of
libtiff. My local libtiff and gdal are both at upstream head. I'm using
bazel for building, so I don't have any autoconf or cmake patches. In case
folks want, here is what I have. Suggestions welcome if I did anything
wrong or missing something.
https://gist.github.com/schwehr/b4b30e1896b14aa3dea7d44e34265965
I have only tried it with gdalinfo and tiffinfo for the two test files in
autotest and it seems to work!
-Kurt
Without:
gdalinfo ~/src/gdal/autotest/gcore/data/gtiff/byte_jxl_dng_1_7_52546.tif
ERROR 1: byte_jxl_dng_1_7_52546.tif: Cannot open TIFF file due to missing
codec of code 52546.
gdalinfo failed - unable to open
'/home/schwehr/src/gdal/autotest/gcore/data/gtiff/byte_jxl_dng_1_7_52546.tif'.
With:
gdalinfo ~/src/gdal/autotest/gcore/data/gtiff/byte_jxl_deprecated_50002.tif
Driver: GTiff/GeoTIFF
Files:
/usr/local/google/home/schwehr/src/gdal/autotest/gcore/data/gtiff/byte_jxl_deprecated_50002.tif
Size is 20, 20
Coordinate System is:
PROJCRS["NAD27 / UTM zone 11N",
[SNIP]
ID["EPSG",26711]]
Data axis to CRS axis mapping: 1,2
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=JXL
INTERLEAVE=BAND
COMPRESSION_REVERSIBILITY=LOSSLESS
JXL_EFFORT=5
Corner Coordinates:
Upper Left ( 440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left ( 440720.000, 3750120.000) (117d38'27.92"W, 33d53'29.51"N)
Upper Right ( 441920.000, 3751320.000) (117d37'41.48"W, 33d54' 8.71"N)
Lower Right ( 441920.000, 3750120.000) (117d37'41.20"W, 33d53'29.75"N)
Center ( 441320.000, 3750720.000) (117d38' 4.70"W, 33d53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray
tiffinfo ~/src/gdal/autotest/gcore/data/gtiff/byte_jxl_deprecated_50002.tif
=== TIFF directory 0 ===
TIFF Directory at offset 0x8 (8)
Image Width: 20 Image Length: 20
Bits/Sample: 8
Sample Format: unsigned integer
Compression Scheme: JXL
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Rows/Strip: 20
Planar Configuration: single image plane
Tag 33550: 60.000000,60.000000,0.000000
Tag 33922:
0.000000,0.000000,0.000000,440720.000000,3751320.000000,0.000000
Tag 34735:
1,1,0,7,1024,0,1,1,1025,0,1,1,1026,34737,21,0,2049,34737,6,21,2054,0,1,9102,3072,0,1,26711,3076,0,1,9001
Tag 34737: NAD27 / UTM zone 11N|NAD27|
GDAL Metadata: <GDALMetadata>
<Item name="COMPRESSION_REVERSIBILITY"
domain="IMAGE_STRUCTURE">LOSSLESS</Item>
<Item name="JXL_EFFORT" domain="IMAGE_STRUCTURE">5</Item>
</GDALMetadata>
On Mon, Jan 6, 2025 at 3:42 PM Kurt Schwehr <schwehr at gmail.com> wrote:
> Thanks Even!
>
> The overtired me kept overlooking frmts/gtiff/tif_jxl.c.
>
> I will give it a go.
>
> On Mon, Jan 6, 2025 at 1:12 PM Even Rouault <even.rouault at spatialys.com>
> wrote:
>
>>
>> Le 06/01/2025 à 22:03, Kurt Schwehr a écrit :
>> > Sounds good to me too (not that I really have the background to say so).
>>
>> master PR: https://github.com/OSGeo/gdal/pull/11586
>>
>> 3.10 partial backport PR: https://github.com/OSGeo/gdal/pull/11587
>>
>> >
>> > 1. Are there any plans to contribute JPEGXL in tiff to
>> > https://gitlab.com/libtiff/libtiff?
>> My plan was that we would do this once https://github.com/libjxl/libjxl/
>> has reached a 1.0 milestone, but I'm not sure if/when they'll be at that
>> point.
>> > 2. And what would one need to do to patch libtiff to use JPEGXL?
>>
>> Copy frmts/gtiff/tif_jxl.c into libtiff sources, register it in
>> tif_codec.c and add support for libjxl detection in libtiff autoconf &
>> cmake
>>
>> Even
>>
>> --
>> http://www.spatialys.com
>> My software is free, but my time generally not.
>> Butcher of all kinds of standards, open or closed formats. At the end,
>> this is just about bytes.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250108/6cfefb0d/attachment.htm>
More information about the gdal-dev
mailing list