Question

Converting GEOTIFF with palette to GEOTIFF b/w


Badge +1

I need to convert 1 Channel, 1 Palette GEOTIFFs to GEOTIFFS with only 1bit (true b/w). So far I managed to split an incoming GEOTIFF-feature into several new GEOTIFF-features (one new feature for each used color in the palette). Afterwords I change them to black and white by using the expression evaluator. Despite the fact that only two colors are used it is technically a 3 channel 8-bit/channel Geotiff right now. By using a RasterSelector and the RasterPaletteGenerator I convert this to a 1 channel 1 Palette Geotiff, where the palette only has two used entries.

However I found no way to save it as a true (1bit) bitmap with the GEOTIFF-Writer.

Any ideas out there?

Uwe


10 replies

Badge +16

Hi @hordor,

Could it be that you need to coerce it into a different interpretation type ? try the RasterInterpretationCoercer before writing.

Hope this helps.

Userlevel 3
Badge +17

Hi @hordor, try setting 1 to the Number of Bits per Cell parameter in the GoeTIFF writer feature type.

Badge +1

Hi thanks for the hints. Using the RasterInterpretationCoercer allows to convert to Grayscale 8bit. Theres for bad luck no setting "bitmap". Setting the "Number of Bits per Cell" seems no to work at all. In the screenshot u can see the result using Number of bits per Cell after converting to Grayscale. Theres still "original color" - in German Originalfarben - 16,7 Million. Any ideas whats wrong?

Userlevel 3
Badge +17

Hi thanks for the hints. Using the RasterInterpretationCoercer allows to convert to Grayscale 8bit. Theres for bad luck no setting "bitmap". Setting the "Number of Bits per Cell" seems no to work at all. In the screenshot u can see the result using Number of bits per Cell after converting to Grayscale. Theres still "original color" - in German Originalfarben - 16,7 Million. Any ideas whats wrong?

Your screenshot seems to show that the original colors is equal to 2 (1bits per pixel) ?

 

 

Badge +1

It is possible to convert it with e. g. Irfan View afterwords. This can be done in batch so there is at least a solution for that. However, as the logic is already done with FME and it is only a problem of saving in the right format it would be much better doing it all the way in FME.

Badge +1

Hi thanks for the hints. Using the RasterInterpretationCoercer allows to convert to Grayscale 8bit. Theres for bad luck no setting "bitmap". Setting the "Number of Bits per Cell" seems no to work at all. In the screenshot u can see the result using Number of bits per Cell after converting to Grayscale. Theres still "original color" - in German Originalfarben - 16,7 Million. Any ideas whats wrong?

This is what is should look like after saving as true bitmap...

 

 

Userlevel 3
Badge +17

Hi thanks for the hints. Using the RasterInterpretationCoercer allows to convert to Grayscale 8bit. Theres for bad luck no setting "bitmap". Setting the "Number of Bits per Cell" seems no to work at all. In the screenshot u can see the result using Number of bits per Cell after converting to Grayscale. Theres still "original color" - in German Originalfarben - 16,7 Million. Any ideas whats wrong?

In my testing, the Current colors (Aktuelle Farben) property seems to become 2 if you set BIP to the Interleaving Type parameter in the GEOTIFF writer feature type.

 

Badge +16

It is possible to convert it with e. g. Irfan View afterwords. This can be done in batch so there is at least a solution for that. However, as the logic is already done with FME and it is only a problem of saving in the right format it would be much better doing it all the way in FME.

You can always call ifranview from within FME via the systemcaller transformer.

 

 

Badge +1

It is possible to convert it with e. g. Irfan View afterwords. This can be done in batch so there is at least a solution for that. However, as the logic is already done with FME and it is only a problem of saving in the right format it would be much better doing it all the way in FME.

I finally made it with the systemcaller. The code in systemcaller is:

 

" "C:\\Program Files (x86)\\IrfanView\\i_view32.exe" "K:\\TK25 bw\\tmp\\*.tif" /bpp=1 /convert="K:\\TK25 bw\\import\\*.tif" "

 

Thanks for your help.

 

 

Badge +1

Hi thanks for the hints. Using the RasterInterpretationCoercer allows to convert to Grayscale 8bit. Theres for bad luck no setting "bitmap". Setting the "Number of Bits per Cell" seems no to work at all. In the screenshot u can see the result using Number of bits per Cell after converting to Grayscale. Theres still "original color" - in German Originalfarben - 16,7 Million. Any ideas whats wrong?

Bad Luck it is not working that way on my system. However the solution with systemcaller works perfectly. Thanks for your hepl.

 

 

Reply