Jpeg 2000 with Alpha Transparency Problem

Has anyone tried to save a render as a jpeg2000 with RGBA?

I can get it to save OK but when I take the image back into Blender via an image input node, I can’t get the alpa channel to appear correctly.

When I plug the alpha channel of the RGBA image into a viewer node, I would expect to see all black where the background would be and all white where the object (e.g. default cube) would be.

I get this fine with png.

With jpeg 2000, I instead get a black and white version of the image - not the alpha channel.

Am I missing something? I’m simply selecting ‘Jpeg 2000’ in the format tab and switching to ‘RGBA’.

Thanks in advance.

bump

Could someone at least test this to see if you get the same result? Honestly won’t take very long! :smiley:

If it turns out to be a bug then it needs to get reported so it can be fixed.

Do something like this:

  • Delete default cube and add Monkey mesh.
  • Change mesh colour to something non-grayscale (e.g. red).
  • ‘Scene’ panel --> ‘Format’ tab --> change file format to Jpeg 2000 and RGB to RGBA to enable alpha channel being saved.
  • Render (F12) and save (F3), ensuring the image is saved with ‘.jp2’ extension.
  • ‘Node Editor’ --> ‘Composite Nodes’ --> add ‘Image’ input node and ‘Viewer’ output node.
  • Load your newly rendered Jpeg 2000 file into the ‘Image’ node.
  • Important: link the ‘Alpha’ channel from ‘Image’ node to the ‘Image’ channel of the ‘Viewer’ node.

You should now see the issue in the viewer node (click ‘Backdrop’ to see a larger version in the background).

Instead of getting pure black (transparent) or pure white (solid) masking, there are shades of gray. Looks likes it saves the luminance channel or something instead of the alpha channel.

For comparison, link up the alpha channel from the ‘Render Layer’ node to a ‘Viewer’ node. Or perform the same steps above but saving as a PNG - you will see the alpha channel properly showing.

It appears that the image’s luminance values are being stored as alpha values. Someone didn’t do their homework on this one.

You might want to contact Campbell Barton on this one, he brought Blender jpeg2000 support to Blender, or just put it in the bug tracker and get it assigned to him.

Cheers for verifying this guys. I’ll pm Campbell.

Crap, your right! can you report a bug in future, I could have fixed this for 2.49b, too late now.
Will look into it after 2.49b freeze is lifted.

Yup, sod’s law - couldn’t get anyone to verify it was a bug until today. Made an entry into the bug tracker (#19280).

Worse case scenario, there should be a workaround. Save your render file that requires the transparency channel (RGBA) in PNG format instead of JPEG2000.

Assuming this will soon be fixed in 2.5, load the PNG via the compositor and save out again as Jpeg 2000.

Or save the PNG file out as Jpeg2000 in an image editing program like GIMP.