Question

Reducing bit depth in TIF images


Badge
Is there a way to reduce the bit depth in TIF images from 24 to 8?

 

 

I've gad a look at the RasterInterpretationCoercer and RasterNandInterpretationCoercer transformers but haven't managed to get very far.

 

 

The ultimate destination is BIX BCP and this is only compatible with 8 bit colour hence the requirement to reduce the bit depth.

 

 

Thanks,

 

 

Matt

5 replies

Userlevel 4
Badge +13
Hi,

 

 

The RasterInterpretationCoercer is what you need, if your goal is a 3 band 8 bit raster select RGB24 as interpretation type.
Badge
Hi Itay,

 

Thanks for your response. Will a RGB24 not gice be 8 bits per band so a total of 24?

 

I need to have a bit depth of 8 bits in total not 8 bits per band. Do you know whether there's a way to achieve this?

 

Thanks,

 

Matt
Badge +3
If u want a single band of 8 bit u must remove the (selected)rasterband(s).

 

U can use a rasterselector and then a rasterbandremover.

 

 

 

 

Badge +3
I looked up BIX colors.

 

Thats a 5x5 coloring of wires. (8 bit color has 256 colors.)

 

So there are only 5 colors total. 25 pairs.

 

According to WIKI (hail WIKI!):

 

 

 

 

 

I think u then best want to create a colormap or a palette.

 

 

U can create a palette using rasterpalettegenerator (there is a toolset in fme to do that).

 

But you also have to make sure that all values map to just the 5 color-pair.
Badge +7

These posts may help:

https://knowledge.safe.com/questions/24156/how-to-create-256-color-raster-where-black-color-i.html

Use a RasterPaletteGenerator with a Palette Key Interpretation Type of "UInt8" and set the Maximum Number of Palette Entries to 256. On the TIFF Writer, set the Interleaving Type on the Format Parameters tab to BIP. See

http://docs.safe.com/fme/2016.0/html/FME_Desktop_Documentation/FME_ReadersWriters/geotiff/format_parameters_w.htm

(Credit to @takashi and @sander_s for these tips).

https://knowledge.safe.com/questions/50756/convert-mix-of-jpeg-and-bw-tiff-to-file-geodatabas.html

By default, the settings from the incoming Tiff data are propagated to the output through the format attributes on the source image. These attributes override the bits per cell and compression set on the output. These format attributes are designed to make TIFF to TIFF conversions simpler, but do assume that the output structure matches the input. Try adding a BulkAttributeRemover to your workspace to remove these attributes - set the Expression to Remove to "tiff_" (without the double quotes).

(Credit to David Campanas at Safe for this tip).

Reply