Skip to main content
Question

Converting GEOTIFF with palette to GEOTIFF b/w


hordor
Contributor
Forum|alt.badge.img+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

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • April 26, 2017

Hi @hordor,

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

Hope this helps.


takashi
Evangelist
  • April 26, 2017

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


hordor
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 26, 2017

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?


takashi
Evangelist
  • April 26, 2017
hordor wrote:

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) ?

 

 


hordor
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 26, 2017

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.


hordor
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 26, 2017
hordor wrote:

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...

 

 


takashi
Evangelist
  • April 27, 2017
hordor wrote:

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.

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • April 27, 2017
hordor wrote:

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.

 

 


hordor
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 27, 2017
hordor wrote:

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.

 

 


hordor
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 27, 2017
hordor wrote:

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


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