Skip to main content
Solved

How to proper save raster to jpeg-format


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

Best answer by debbiatsafe

henrikandersson wrote:

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.

View original
Did this help you find an answer to your question?

4 replies

debbiatsafe
Safer
Forum|alt.badge.img+20

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


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • Best Answer
  • March 3, 2021
henrikandersson wrote:

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.


debbiatsafe wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings