IMAGINE Discussions

Showing results for 
Search instead for 
Do you mean 
Super Contributor
Posts: 455
Registered: ‎10-12-2015
Accepted Solution

PNG 8bit (1 band) to JPG2000 or ECW (lossless)

[ Edited ]

I have a bunch of colour 8bit PNG files that I'd like to convert to JPG2000 or ECW (lossless). Target is adding to Apollo Core.
The PNG files are regenerated periodically.

Each PNG has a world file and an .aux file (aux generated via Imagine Edit Metadata).
The PNG shows in Imagine as single band image, displays as colour as desired.
When converting to JP2000 imagine shows message 'Input image must be athematic'. I'm picking that is because the input PNG is 8bit / 1 band.
If I convert the PNG to TIF using another converter and add an world file and AUX, I get same message.

Is it possible to convert the PNG to JPG2000 without the text / linework in the source being modified? (All my experiments so far result in the text being modified and not looking as good as the source, even if I go to 32bit PNG).


Example input 8 bit PNG input file:



Example of image displaying in Imagine with the metadata


Example pgw world file:



While the PNG shows in Imagine, they do not directly work in Apollo Core (does not pick up coordinate system etc). 

If lossless conversion - including retaining text and linework fidelity - is achievable, next step would be to mosaic the input PNG files together - though just getting individual png to jpg2000 or ecw (lossless) would likely be enough.

Frequent Contributor
Posts: 153
Registered: ‎10-27-2015

Re: PNG 8bit (1 band) to JPG2000 or ECW (lossless)

[ Edited ]

ECW & JP2 are designed on natural images - pictures in nutshell. Your data is Thematic just as error message says - so each pixel value has a meaning.  You also have a huge single color areas which means your file should compress very well with ancient Run Length Encoding (RLE) or just TIF LZW.


So I see no point going from your data to 3 band RGB just to make wawelenght compression which is not optimal for your data. You get equal or even better compressions when using TIF RLE or something like that. ECW/JP2 leads you easily to RGB file and that means tripling your data just because of the format when single banmd turns to three band RGB. It makes no sense unless ECW/JP2 is a must format for you.


So if you want to keep your data just as it is and decrease the filesize then format should be TIF RLE/LZW. In case ECWP streaming is what you search then most likely you must go on RGB ECW/JP2 but then you most likely increase the data size. I am not sure does JP2 offer thematic single band variants for Apollo, but for ECW I have a feeling that RGB is only option as single band ECW is always grayscale.