[gdal-dev] Error writing/reading simple ENVI file

Andrew C Aitchison andrew at aitchison.me.uk
Thu Sep 10 07:09:01 PDT 2020


On Thu, 10 Sep 2020, Calogero Mauceri wrote:

> I convert the file to ENVI format using gdal_translate command:
>     gdal_translate -of ENVI test.tiff test.IMG
>
> The command does not give any errors. When I read back the ENVI file I get
> the following error:
>
>    gdalinfo test.IMG -mm
> ERROR 1: A marker ID was expected (0xff--) instead of 000028fc
>
> ERROR 1: opj_read_header() failed
> gdalinfo failed - unable to open 'my_path\test.IMG'.
>
> I'm not sure why it tries to open the ENVI file using the OpenJPEG reader.
> Anyway I'm using GDAL 2.4.4 and OpenJPEG 2.3.0. I tried GDAL 3.1.2, but I
> get the same error.

gdalinfo -oo GDAL_SKIP="JP2OpenJPEG JP2ECW" test.IMG -mm
works for me. You can also set GDAL_SKIP in the environment
(with export or setenv on Unix, depending upon your shell).
I imagine the this file accidentally matches the JPEG "magic" header.

-- 
Andrew C. Aitchison					Kendal, UK
 			andrew at aitchison.me.uk


More information about the gdal-dev mailing list