Skip to main content

Hi,

 

I'd like to save raster to the JPEG format. The raster includes an alpha band. In order to save to JPEG the alpha band needs to be removed. When the alpha band is there the background appears white in FME Inspector.

 

When I remove the alpha band the background turns black. That's also the background color when I save the raster to JPEG. How can I work around this problem and make the background white when I save to JPEG?

 

With the alpha band. White background.

pic1Without the alpha band. The background turns black. I don't want that.

pic2

Hi @henrikandersson​ 

Try using the RasterInterpretationCoercer instead of removing the alpha band. The destination interpretation type parameter should be RGB24--ensure the RGBA to RGB parameter is 'Apply the alpha band'.


Thank you for your quick reply. I noticed something else in the process. The transformer seems to invert colors. Blue turns to red for example. Why is that and how can I avoid it?

 

Before the transformer

pic3 

After the transformerpic4


Thank you for your quick reply. I noticed something else in the process. The transformer seems to invert colors. Blue turns to red for example. Why is that and how can I avoid it?

 

Before the transformer

pic3 

After the transformerpic4

Hi @henrikandersson​ 

Your initial screenshot shows your input is a BGRA32 raster (instead of RGBA32). Two of the raster bands were switched when the raster was coerced to RGB24. You should be able to avoid the issue by using a RasterBandOrderer (band list: 2 1 0 3) before the RasterInterpretationCoercer.


Hi @henrikandersson​ 

Your initial screenshot shows your input is a BGRA32 raster (instead of RGBA32). Two of the raster bands were switched when the raster was coerced to RGB24. You should be able to avoid the issue by using a RasterBandOrderer (band list: 2 1 0 3) before the RasterInterpretationCoercer.

Thank you. That worked wonders.


Reply