Opened 7 years ago

Closed 7 years ago

#7084 closed defect (duplicate)

gdal_merge -separate creates invalid file when last input image has fewer lines

Reported by: s0sh0rt Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 2.1.0
Severity: normal Keywords:
Cc:

Description

gdal_merge -separate to stack variable sized input image files works. However the output file is short if the last input file has fewer lines. In my case I am outputting an ENVI file. Note that other short input images are padded correctly.

gdal_merge.py -separate -f ENVI -o output {list of 46 input files}

output file: 8612 samples, 3511 lines, 46 bands, 4 byte floats = 5563558688 the file size created is: 5542166480

This is exactly 621 lines short, which is the same as the number of lines missing from the last input band #46 which is: 8612 x 2890

gdal_merge terminates successfully at 100%, however the file cannot be completely read successfully by other applications or GDAL.

A possible workaround for this is to just append (pad) the correct number (or more) zeros to the end of the ENVI data file.

Change History (1)

comment:1 by Even Rouault, 7 years ago

Resolution: duplicate
Status: newclosed

It looks like this a bug that has been fixed in GDAL >= 2.1.2

ENVI driver:
 * on closing, pad image file with trailing nul bytes if needed (#6662)
Note: See TracTickets for help on using tickets.