Bug in JPEG2000 reader

I’m struggling with a bug in your sentinel 2 toolbox as i tried to update my maven dependency from 6.0.2 to 7.0.0 . The following test code illustrates the actual problem:

public class Sen2TbxVersionColorFail {
public void testVersionColorFail() throws IOException {
final File imageFile = new File(“Z:\Maps\test_taua\a2e0e078-5960-4008-9324-8709b2c68d14\S2B_MSIL2A_20190817T101029_N0213_R022_T33UVP_20190817T143953.SAFE\GRANULE\L2A_T33UVP_A012775_20190817T101605\IMG_DATA\R10m\T33UVP_20190817T101029_TCI_10m.jp2”);

    final Product snapProduct = new JP2ProductReaderPlugin().createReaderInstance().readProductNodes(imageFile, null);

    final Rectangle part = new Rectangle(0, 0, 10, 10);

    final MultiLevelImage multiLevelImage = snapProduct.getBands()[0].getSourceImage();

    final BufferedImage bufferedImage = multiLevelImage.getAsBufferedImage(part, multiLevelImage.getColorModel());


Obviously im loading a 10m true color image of Sentinel 2 level 2A when i get the error (getColorModel() returns null).

the snap engine version is 6.0.8 when it works and 7.0.0 when it fails.

Thanks for you help in advance.


We will look into this. Thank you for reporting it.

I have created an issue for fixing this:

Best regards,