Opened 13 years ago

Last modified 13 years ago

#1348 closed defect (fixed)

bad format conversion with HFA (Imagine) compressed blocks

Reported by: marc.peterson@… Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 1.3.2
Severity: normal Keywords:


FWTools 1.0.7 / gdal_translate.exe 1.3.2 on Windows XP SP 2

When using gdal_translate.exe to export an Imagine image file to another format, the output images contain blocks of striping where pixel data is not translated.  ERDAS Imagine uses two-stage run length encoding when optional compression is applied.  This problem only occurs on Imagine files with the compression applied; non-compressed Imagine files work fine.

A compressed Imagine file, GIF and PNG output files, and my command log may be retrieved from

Change History (2)

comment:1 Changed 13 years ago by warmerdam


Thanks, I have tracked this down and fixed it. 

The problem was that UncompressBlock() in hfaband.cpp was returning the
u4 data expanded to 8bit when the expansion is supposed to be done in
hfadataset.cpp.  Actually, UncompressBlock() only made this mistake for
literal tiles, not tiles that were actually compressed. 

I also discovered a glitch in hfadataset.cpp with unpacking 2 and 4 bit data
that resulted in the second pixel of each block getting set wrong.  Also 

comment:2 Changed 13 years ago by warmerdam

Sample dataset kept for posterity as ~/data/hfa/u4_compress_33436584.img
Note: See TracTickets for help on using tickets.