Page 1 of 1

Issues converting to 8bit Tif

Posted: 2018-01-19T13:46:09-07:00
by rossoe
I have an application that requires input of 8bit lzw compressed tif files

the original images are 'bmp's' and are fairly large 40960 x 40960 - (aerial photography)

So handling them in Photoshop was not possible as a single image, I splice them into 4 tiles or 20480.

I needed to convert these 4 bmp's into tif's and then stitch them back into a single image.

It seemed faster for me to convert to tif in PS, so I then had 4 tif's which were showing as 8bit

I then used combo of the following commands to stitch back into one image:

Code: Select all

magick convert -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb *.tif +append output.tif

magick convert -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb *.tif -append output.tif
so I had a nice single image - I ran an 'identify' command which seemed to show 8bit depth:

Code: Select all

E:\test\8bit\Final>magick identify -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb -verbose iow_8bit.tif
load image[iow_8bit.tif]: 40959 of 40960, 100% complete
Image: iow_8bit.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 40960x40960+0+0
  Resolution: 72x72
  Print size: 568.889x568.889
  Units: PixelsPerInch
  Type: Palette
  Base type: TrueColor
  Endianess: LSB
  Colorspace: sRGB
  Depth:[b] 8-bit[/b]
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
 Transparent color: none
 Interlace: None
 Intensity: Undefined
 Compose: Over
 Page geometry: 40960x40960+0+0
 Dispose: Undefined
 Iterations: 0

 Compression: LZW
I could not check the properties of the image in explorer as it did not seem to hold any info?

but double checking in irfanview showed it was still:
16,7 Million (24 BitsPerPixel)

So I ended up just using irfanview to decrease colour depth to 256, and it was then in the right 8bit format.

I would like to know what I'm doing wrong in Imagemagick? as my 4 x 8bit tif's are suddenly turning back to 24bit when stitching into a single image!

Re: Issues converting to 8bit Tif

Posted: 2018-01-19T15:50:11-07:00
by snibgo
I'm not clear what you want, or what the problem is. From identify, you have 3 channels. If they are 8 bits/channel, that is 24 bits/pixel in total.

Do you want palette files, that are 8 bits per pixel total? Then use "-type palette".

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T01:45:52-07:00
by rossoe
So here are the 'identify' details on the 4 images before I stitch them together with ImageMagick:

iow_1x1m_8bit.tif

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8/1-bit
  Channel depth:
    Red: 1-bit
    Green: 1-bit
    Blue: 1-bit
iow_1x2m_8bit.tif

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8/1-bit
  Channel depth:
    Red: 1-bit
    Green: 1-bit
    Blue: 1-bit
iow_2x1m_8bit.tif

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
iow_2x2m_8bit.tif

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8/1-bit
  Channel depth:
    Red: 1-bit
    Green: 1-bit
    Blue: 1-bit
The resulting single image is coming out as:

Code: Select all

  Type: Palette
  Base type: TrueColor
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
"Base type: TrueColor" comes into play?

So are you saying I need to add the "-type palette" flag within my append type commands:

Code: Select all

magick convert -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb *.tif +append output.tif

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T07:20:09-07:00
by snibgo
Your four input images have palettes. Your output also has a palette.

Isn't that what you want? Please say what problem you want to solve.

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T10:40:31-07:00
by rossoe
Even though the identify is showing "Depth: 8-bit", when I checked the final single image in irfanview it said it was back to 24bit
https://imgur.com/a/RnPab

I needed the final single image to be 8bit

So I had to decrease colour depth in irfanview to get it back to 8bit again
https://imgur.com/a/RnPab

But I would rather be able to do the whole process in imagemagick.

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T10:52:41-07:00
by snibgo
I repeat:

Do you want palette files, that are 8 bits per pixel total? Then use "-type palette".

Does that do what you want?

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T13:52:20-07:00
by rossoe
I'm after 8bit (indexed colour - 256 colours)

Type: Palette
Base type: TrueColor < **** does this mean that it's 24 bit? *****
Endianess: LSB
Colorspace: sRGB
Depth: 8-bit < ** regardless of this **
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 1-bit

I ran this command on all my append's:

magick convert -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb *.tif +append -type palette -depth 8 output1.tif

and I end up with a single image with these properties:

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 2/8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
Explorer see's it as 4bit

Irfanview see's it as this:
https://imgur.com/a/jYFDY

Does this look right?

Re: Issues converting to 8bit Tif

Posted: 2018-01-20T14:17:46-07:00
by snibgo
So you care about how the file is stored. Is that right? You want that to be paletted.

Don't ask IM how the file is stored. IM won't tell you. IM will tell you about the image (not the file) after the image has been read into memory.

exiftool will tell you about the file. Other tools might also.

Re: Issues converting to 8bit Tif

Posted: 2018-01-21T14:59:06-07:00
by rossoe
Thank you for your help on this snibgo by the way, i apologise as I am not familiar with image bit depth and colour profiles
I have been trying to read up on it here:
https://books.google.co.uk/books?id=6KV ... on&f=false

So I tested stitching together using commands which now includes the "-type palette"
example:

Code: Select all

magick convert -monitor -define registry:temporary-path=E:\Windows\Temp -limit memory 16mb *.tif +append -type palette output4.tif
The result was a single file with these details:

Code: Select all

Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 2/8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
This failed to work in the application which appears to be fussy re input image.

Comparing the image that does work in the application -
which was 'reduced to 256 colours' using irfanview it has these properties:

Code: Select all

 Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
I've progressed in terms of the final image not jumping back to 24 bit because I've added in the -type palette variable.

Am i able to enforce particular channel depth (blue) to match working example above?

what does the Depth: 2/8-bit actually mean?

Re: Issues converting to 8bit Tif

Posted: 2018-01-21T15:27:04-07:00
by snibgo
rossoe wrote:what does the Depth: 2/8-bit actually mean?
It means that after ImageMagick has read the image, by one measure the pixels need only 2 bits, and by another they need 8 bits. I forget the details of the measures. You can see that IM has figured the red and green channels need 8 bits but the blue channel needs only 1 bit.

The colormap (later in the "identify -verbose" listing) may provide clues.

Re: Issues converting to 8bit Tif

Posted: 2018-01-24T17:41:31-07:00
by rossoe
Ok so I ran a 'identify' on both, could you please help me check what it so different which I might be able to fix with a revised command -

seems like my application is happy with a tif when the colormap is buffered out to 256 colours? - but are you able to preserve that from the source tif's?

The 4 images that are stitched together to make the final working one below, are also showing the buffered out 256 colours (They were converted in Photoshop to 'indexed colour').

image that is working in application:

Code: Select all

Image: iow_8bitreal.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: PseudoClass
  Geometry: 40960x40960+0+0
  Resolution: 72x72
  Print size: 568.889x568.889
  Units: PixelsPerInch
  Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Pixels: 1677721600
    Red:
      min: 1 (0.00392157)
      max: 207 (0.811765)
      mean: 1.32585 (0.0051994)
      standard deviation: 8.13319 (0.0318949)
      kurtosis: 631.4
      skewness: 25.1291
      entropy: 0.0113728
    Green:
      min: 1 (0.00392157)
      max: 255 (1)
      mean: 59.5293 (0.233448)
      standard deviation: 106.842 (0.418989)
      kurtosis: -0.356985
      skewness: 1.2806
      entropy: 0.397466
    Blue:
      min: 1 (0.00392157)
      max: 255 (1)
      mean: 196.235 (0.769548)
      standard deviation: 107.112 (0.420048)
      kurtosis: -0.376726
      skewness: -1.27408
      entropy: 0.780374
  Image statistics:
    Overall:
      min: 1 (0.00392157)
      max: 255 (1)
      mean: 85.6966 (0.336065)
      standard deviation: 119.689 (0.469368)
      kurtosis: -1.50008
      skewness: 0.706396
      entropy: 0.297303
  Compute image colors...  [iow_8bitreal.tif]: 40959 of 40960, 100% complete
  Colors: 4
  Histogram:
  Compute image colors...  [iow_8bitreal.tif]: 40959 of 40960, 100% complete
1289564662: (  1,  1,255) #0101FF srgb(1,1,255)
 385407459: (  1,255,  1) #01FF01 srgb(1,255,1) 4, 00% complete
    149340: ( 75, 41,  1) #4B2901 srgb(75,41,1)
   2600139: (207,115,  1) #CF7301 srgb(207,115,1)
compute image histogram[iow_8bitreal.tif]: 3 of 4, 100% complete
  Colormap entries: 256
  Colormap:
         0: ( 75, 41,  1,255) #4B2901FF srgba(75,41,1,1)
         1: (  1,255,  1,255) #01FF01FF srgba(1,255,1,1)
         2: (  1,  1,255,255) #0101FFFF srgba(1,1,255,1)
         3: (207,115,  1,255) #CF7301FF srgba(207,115,1,1)
         4: (  0,  0,  0,255) #000000FF black
         5: (  0,  0,  0,255) #000000FF black
         6: (  0,  0,  0,255) #000000FF black
         7: (  0,  0,  0,255) #000000FF black
         8: (  0,  0,  0,255) #000000FF black
         9: (  0,  0,  0,255) #000000FF black
        10: (  0,  0,  0,255) #000000FF black
        11: (  0,  0,  0,255) #000000FF black
        12: (  0,  0,  0,255) #000000FF black
        13: (  0,  0,  0,255) #000000FF black
        14: (  0,  0,  0,255) #000000FF black
        15: (  0,  0,  0,255) #000000FF black
        16: (  0,  0,  0,255) #000000FF black
        17: (  0,  0,  0,255) #000000FF black
        18: (  0,  0,  0,255) #000000FF black
        19: (  0,  0,  0,255) #000000FF black
        20: (  0,  0,  0,255) #000000FF black
        21: (  0,  0,  0,255) #000000FF black
        22: (  0,  0,  0,255) #000000FF black
        23: (  0,  0,  0,255) #000000FF black
        24: (  0,  0,  0,255) #000000FF black
        25: (  0,  0,  0,255) #000000FF black
        26: (  0,  0,  0,255) #000000FF black
        27: (  0,  0,  0,255) #000000FF black
        28: (  0,  0,  0,255) #000000FF black
        29: (  0,  0,  0,255) #000000FF black
        30: (  0,  0,  0,255) #000000FF black
        31: (  0,  0,  0,255) #000000FF black
        32: (  0,  0,  0,255) #000000FF black
        33: (  0,  0,  0,255) #000000FF black
        34: (  0,  0,  0,255) #000000FF black
        35: (  0,  0,  0,255) #000000FF black
        36: (  0,  0,  0,255) #000000FF black
        37: (  0,  0,  0,255) #000000FF black
        38: (  0,  0,  0,255) #000000FF black
        39: (  0,  0,  0,255) #000000FF black
        40: (  0,  0,  0,255) #000000FF black
        41: (  0,  0,  0,255) #000000FF black
        42: (  0,  0,  0,255) #000000FF black
        43: (  0,  0,  0,255) #000000FF black
        44: (  0,  0,  0,255) #000000FF black
        45: (  0,  0,  0,255) #000000FF black
        46: (  0,  0,  0,255) #000000FF black
        47: (  0,  0,  0,255) #000000FF black
        48: (  0,  0,  0,255) #000000FF black
        49: (  0,  0,  0,255) #000000FF black
        50: (  0,  0,  0,255) #000000FF black
        51: (  0,  0,  0,255) #000000FF black
        52: (  0,  0,  0,255) #000000FF black
        53: (  0,  0,  0,255) #000000FF black
        54: (  0,  0,  0,255) #000000FF black
        55: (  0,  0,  0,255) #000000FF black
        56: (  0,  0,  0,255) #000000FF black
        57: (  0,  0,  0,255) #000000FF black
        58: (  0,  0,  0,255) #000000FF black
        59: (  0,  0,  0,255) #000000FF black
        60: (  0,  0,  0,255) #000000FF black
        61: (  0,  0,  0,255) #000000FF black
        62: (  0,  0,  0,255) #000000FF black
        63: (  0,  0,  0,255) #000000FF black
        64: (  0,  0,  0,255) #000000FF black
        65: (  0,  0,  0,255) #000000FF black
        66: (  0,  0,  0,255) #000000FF black
        67: (  0,  0,  0,255) #000000FF black
        68: (  0,  0,  0,255) #000000FF black
        69: (  0,  0,  0,255) #000000FF black
        70: (  0,  0,  0,255) #000000FF black
        71: (  0,  0,  0,255) #000000FF black
        72: (  0,  0,  0,255) #000000FF black
        73: (  0,  0,  0,255) #000000FF black
        74: (  0,  0,  0,255) #000000FF black
        75: (  0,  0,  0,255) #000000FF black
        76: (  0,  0,  0,255) #000000FF black
        77: (  0,  0,  0,255) #000000FF black
        78: (  0,  0,  0,255) #000000FF black
        79: (  0,  0,  0,255) #000000FF black
        80: (  0,  0,  0,255) #000000FF black
        81: (  0,  0,  0,255) #000000FF black
        82: (  0,  0,  0,255) #000000FF black
        83: (  0,  0,  0,255) #000000FF black
        84: (  0,  0,  0,255) #000000FF black
        85: (  0,  0,  0,255) #000000FF black
        86: (  0,  0,  0,255) #000000FF black
        87: (  0,  0,  0,255) #000000FF black
        88: (  0,  0,  0,255) #000000FF black
        89: (  0,  0,  0,255) #000000FF black
        90: (  0,  0,  0,255) #000000FF black
        91: (  0,  0,  0,255) #000000FF black
        92: (  0,  0,  0,255) #000000FF black
        93: (  0,  0,  0,255) #000000FF black
        94: (  0,  0,  0,255) #000000FF black
        95: (  0,  0,  0,255) #000000FF black
        96: (  0,  0,  0,255) #000000FF black
        97: (  0,  0,  0,255) #000000FF black
        98: (  0,  0,  0,255) #000000FF black
        99: (  0,  0,  0,255) #000000FF black
       100: (  0,  0,  0,255) #000000FF black
       101: (  0,  0,  0,255) #000000FF black
       102: (  0,  0,  0,255) #000000FF black
       103: (  0,  0,  0,255) #000000FF black
       104: (  0,  0,  0,255) #000000FF black
       105: (  0,  0,  0,255) #000000FF black
       106: (  0,  0,  0,255) #000000FF black
       107: (  0,  0,  0,255) #000000FF black
       108: (  0,  0,  0,255) #000000FF black
       109: (  0,  0,  0,255) #000000FF black
       110: (  0,  0,  0,255) #000000FF black
       111: (  0,  0,  0,255) #000000FF black
       112: (  0,  0,  0,255) #000000FF black
       113: (  0,  0,  0,255) #000000FF black
       114: (  0,  0,  0,255) #000000FF black
       115: (  0,  0,  0,255) #000000FF black
       116: (  0,  0,  0,255) #000000FF black
       117: (  0,  0,  0,255) #000000FF black
       118: (  0,  0,  0,255) #000000FF black
       119: (  0,  0,  0,255) #000000FF black
       120: (  0,  0,  0,255) #000000FF black
       121: (  0,  0,  0,255) #000000FF black
       122: (  0,  0,  0,255) #000000FF black
       123: (  0,  0,  0,255) #000000FF black
       124: (  0,  0,  0,255) #000000FF black
       125: (  0,  0,  0,255) #000000FF black
       126: (  0,  0,  0,255) #000000FF black
       127: (  0,  0,  0,255) #000000FF black
       128: (  0,  0,  0,255) #000000FF black
       129: (  0,  0,  0,255) #000000FF black
       130: (  0,  0,  0,255) #000000FF black
       131: (  0,  0,  0,255) #000000FF black
       132: (  0,  0,  0,255) #000000FF black
       133: (  0,  0,  0,255) #000000FF black
       134: (  0,  0,  0,255) #000000FF black
       135: (  0,  0,  0,255) #000000FF black
       136: (  0,  0,  0,255) #000000FF black
       137: (  0,  0,  0,255) #000000FF black
       138: (  0,  0,  0,255) #000000FF black
       139: (  0,  0,  0,255) #000000FF black
       140: (  0,  0,  0,255) #000000FF black
       141: (  0,  0,  0,255) #000000FF black
       142: (  0,  0,  0,255) #000000FF black
       143: (  0,  0,  0,255) #000000FF black
       144: (  0,  0,  0,255) #000000FF black
       145: (  0,  0,  0,255) #000000FF black
       146: (  0,  0,  0,255) #000000FF black
       147: (  0,  0,  0,255) #000000FF black
       148: (  0,  0,  0,255) #000000FF black
       149: (  0,  0,  0,255) #000000FF black
       150: (  0,  0,  0,255) #000000FF black
       151: (  0,  0,  0,255) #000000FF black
       152: (  0,  0,  0,255) #000000FF black
       153: (  0,  0,  0,255) #000000FF black
       154: (  0,  0,  0,255) #000000FF black
       155: (  0,  0,  0,255) #000000FF black
       156: (  0,  0,  0,255) #000000FF black
       157: (  0,  0,  0,255) #000000FF black
       158: (  0,  0,  0,255) #000000FF black
       159: (  0,  0,  0,255) #000000FF black
       160: (  0,  0,  0,255) #000000FF black
       161: (  0,  0,  0,255) #000000FF black
       162: (  0,  0,  0,255) #000000FF black
       163: (  0,  0,  0,255) #000000FF black
       164: (  0,  0,  0,255) #000000FF black
       165: (  0,  0,  0,255) #000000FF black
       166: (  0,  0,  0,255) #000000FF black
       167: (  0,  0,  0,255) #000000FF black
       168: (  0,  0,  0,255) #000000FF black
       169: (  0,  0,  0,255) #000000FF black
       170: (  0,  0,  0,255) #000000FF black
       171: (  0,  0,  0,255) #000000FF black
       172: (  0,  0,  0,255) #000000FF black
       173: (  0,  0,  0,255) #000000FF black
       174: (  0,  0,  0,255) #000000FF black
       175: (  0,  0,  0,255) #000000FF black
       176: (  0,  0,  0,255) #000000FF black
       177: (  0,  0,  0,255) #000000FF black
       178: (  0,  0,  0,255) #000000FF black
       179: (  0,  0,  0,255) #000000FF black
       180: (  0,  0,  0,255) #000000FF black
       181: (  0,  0,  0,255) #000000FF black
       182: (  0,  0,  0,255) #000000FF black
       183: (  0,  0,  0,255) #000000FF black
       184: (  0,  0,  0,255) #000000FF black
       185: (  0,  0,  0,255) #000000FF black
       186: (  0,  0,  0,255) #000000FF black
       187: (  0,  0,  0,255) #000000FF black
       188: (  0,  0,  0,255) #000000FF black
       189: (  0,  0,  0,255) #000000FF black
       190: (  0,  0,  0,255) #000000FF black
       191: (  0,  0,  0,255) #000000FF black
       192: (  0,  0,  0,255) #000000FF black
       193: (  0,  0,  0,255) #000000FF black
       194: (  0,  0,  0,255) #000000FF black
       195: (  0,  0,  0,255) #000000FF black
       196: (  0,  0,  0,255) #000000FF black
       197: (  0,  0,  0,255) #000000FF black
       198: (  0,  0,  0,255) #000000FF black
       199: (  0,  0,  0,255) #000000FF black
       200: (  0,  0,  0,255) #000000FF black
       201: (  0,  0,  0,255) #000000FF black
       202: (  0,  0,  0,255) #000000FF black
       203: (  0,  0,  0,255) #000000FF black
       204: (  0,  0,  0,255) #000000FF black
       205: (  0,  0,  0,255) #000000FF black
       206: (  0,  0,  0,255) #000000FF black
       207: (  0,  0,  0,255) #000000FF black
       208: (  0,  0,  0,255) #000000FF black
       209: (  0,  0,  0,255) #000000FF black
       210: (  0,  0,  0,255) #000000FF black
       211: (  0,  0,  0,255) #000000FF black
       212: (  0,  0,  0,255) #000000FF black
       213: (  0,  0,  0,255) #000000FF black
       214: (  0,  0,  0,255) #000000FF black
       215: (  0,  0,  0,255) #000000FF black
       216: (  0,  0,  0,255) #000000FF black
       217: (  0,  0,  0,255) #000000FF black
       218: (  0,  0,  0,255) #000000FF black
       219: (  0,  0,  0,255) #000000FF black
       220: (  0,  0,  0,255) #000000FF black
       221: (  0,  0,  0,255) #000000FF black
       222: (  0,  0,  0,255) #000000FF black
       223: (  0,  0,  0,255) #000000FF black
       224: (  0,  0,  0,255) #000000FF black
       225: (  0,  0,  0,255) #000000FF black
       226: (  0,  0,  0,255) #000000FF black
       227: (  0,  0,  0,255) #000000FF black
       228: (  0,  0,  0,255) #000000FF black
       229: (  0,  0,  0,255) #000000FF black
       230: (  0,  0,  0,255) #000000FF black
       231: (  0,  0,  0,255) #000000FF black
       232: (  0,  0,  0,255) #000000FF black
       233: (  0,  0,  0,255) #000000FF black
       234: (  0,  0,  0,255) #000000FF black
       235: (  0,  0,  0,255) #000000FF black
       236: (  0,  0,  0,255) #000000FF black
       237: (  0,  0,  0,255) #000000FF black
       238: (  0,  0,  0,255) #000000FF black
       239: (  0,  0,  0,255) #000000FF black
       240: (  0,  0,  0,255) #000000FF black
       241: (  0,  0,  0,255) #000000FF black
       242: (  0,  0,  0,255) #000000FF black
       243: (  0,  0,  0,255) #000000FF black
       244: (  0,  0,  0,255) #000000FF black
       245: (  0,  0,  0,255) #000000FF black
       246: (  0,  0,  0,255) #000000FF black
       247: (  0,  0,  0,255) #000000FF black
       248: (  0,  0,  0,255) #000000FF black
       249: (  0,  0,  0,255) #000000FF black
       250: (  0,  0,  0,255) #000000FF black
       251: (  0,  0,  0,255) #000000FF black
       252: (  0,  0,  0,255) #000000FF black
       253: (  0,  0,  0,255) #000000FF black
       254: (  0,  0,  0,255) #000000FF black
       255: (  0,  0,  0,255) #000000FF black
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 40960x40960+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2018-01-19T07:36:13+00:00
    date:modify: 2018-01-19T07:36:18+00:00
    signature: 54c321aafeb789e8a45ddd0626be1d00288cd0a7d5ae7d8616a0d4a2e4b71726
    tiff:alpha: unspecified
    tiff:endian: lsb
    tiff:photometric: palette
    tiff:rows-per-strip: 1024
    tiff:software: IrfanView
  Artifacts:
    verbose: true
  Registry:
    temporary-path: E:\Windows\Temp
  Tainted: False
  Filesize: 2.15274MiB
  Number pixels: 1.67772G
  Pixels per second: 5098450B
  User time: 16.344u
  Elapsed time: 5:30.064
  Version: ImageMagick 7.0.6-3 Q16 x64 2017-07-24 http://www.imagemagick.org

Image that is not working in application:

Code: Select all

Image: output.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: PseudoClass
  Geometry: 40960x40960+0+0
  Resolution: 72x72
  Print size: 568.889x568.889
  Units: PixelsPerInch
  Type: Palette
  Endianess: LSB
  Colorspace: sRGB
  Depth: 2/8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 1-bit
  Channel statistics:
    Pixels: 1677721600
    Red:
      min: 0 (0)
      max: 2 (0.811765)
      mean: 0.00385172 (0.00128391)
      standard deviation: 0.0961456 (0.0320485)
      kurtosis: 631.478
      skewness: 25.1308
      entropy: 0.0113728
    Green:
      min: 0 (0)
      max: 3 (1)
      mean: 0.691302 (0.230434)
      standard deviation: 1.26192 (0.42064)
      kurtosis: -0.357067
      skewness: 1.28057
      entropy: 0.397466
    Blue:
      min: 0 (0)
      max: 3 (1)
      mean: 2.30592 (0.76864)
      standard deviation: 1.26511 (0.421702)
      kurtosis: -0.376725
      skewness: -1.27408
      entropy: 0.780374
  Image statistics:
    Overall:
      min: 0 (0)
      max: 3 (1)
      mean: 1.00036 (0.333453)
      standard deviation: 1.41365 (0.471217)
      kurtosis: -1.5001
      skewness: 0.706386
      entropy: 0.297303
  Compute image colors...  [output.tif]: 40959 of 40960, 100% complete
  Colors: 4
  Histogram:
  Compute image colors...  [output.tif]: 40959 of 40960, 100% complete
1289564662: (  0,  0,255) #0000FF blue
 385407459: (  0,255,  0) #00FF00 lime of 4, 00% complete
    149340: ( 74, 41,  0) #4A2900 srgb(74,41,0)
   2600139: (207,115,  0) #CF7300 srgb(207,115,0)
compute image histogram[output.tif]: 3 of 4, 100% complete
  Colormap entries: 4
  Colormap:
         0: ( 74, 41,  0,255) #4A2900FF srgba(74,41,0,1)
         1: (207,115,  0,255) #CF7300FF srgba(207,115,0,1)
         2: (  0,255,  0,255) #00FF00FF lime
         3: (  0,  0,255,255) #0000FFFF blue
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 40960x40960+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
  Orientation: TopLeft
  Properties:
    date:create: 2018-01-21T19:16:27+00:00
    date:modify: 2018-01-21T19:22:08+00:00
    dc:format: image/tiff
    icc:copyright: Copyright (c) 1998 Hewlett-Packard Company
    icc:description: sRGB IEC61966-2.1
    icc:manufacturer: IEC http://www.iec.ch
    icc:model: IEC 61966-2.1 Default RGB colour space - sRGB
    photoshop:ColorMode: 2
    photoshop:ICCProfile: sRGB IEC61966-2.1
    signature: e80109e433df98d95a7c01cc7090290c7153813825664641ca9d337a1dcdbd55
    tiff:alpha: unspecified
    tiff:endian: lsb
    tiff:photometric: palette
    tiff:rows-per-strip: 40960
    xmp:CreateDate: 2017-03-12T00:08:01Z
    xmp:CreatorTool: Adobe Photoshop CS6 (Windows)
    xmp:MetadataDate: 2018-01-14T19:52:47Z
    xmp:ModifyDate: 2018-01-14T19:52:47Z
    xmpMM:DocumentID: xmp.did:497EBA65ECF7E711AF28BFB9A6A29B7F
    xmpMM:InstanceID: xmp.iid:7A25727E64F9E7118F5591A4DCCCE539
    xmpMM:OriginalDocumentID: xmp.did:497EBA65ECF7E711AF28BFB9A6A29B7F
  Profiles:
    Profile-8bim: 4418 bytes
    Profile-icc: 3144 bytes
    Profile-xmp: 15144 bytes
  Artifacts:
    verbose: true
  Registry:
    temporary-path: E:\Windows\Temp
  Tainted: False
  Filesize: 821062B
  Number pixels: 1.67772G
  Pixels per second: 5.06453MB
  User time: 17.859u
  Elapsed time: 5:32.268
  Version: ImageMagick 7.0.6-3 Q16 x64 2017-07-24 http://www.imagemagick.org

Re: Issues converting to 8bit Tif

Posted: 2018-01-24T18:07:19-07:00
by snibgo
As you can see, your images have only four colours. The "not working" version has a colormap (in memory) of only four entries, hence the "2 bits" for the depth: each pixel has only 2 bits, because that's all they need.

I don't think IM has a method to force the colormap (in memory or in file) to be larger than it needs to be.

What software is tying to read your "not working" image? You might report the problem to them.

Re: Issues converting to 8bit Tif

Posted: 2018-01-25T01:00:44-07:00
by rossoe
It's a custom built mod that runs on top of Arma 3 engine to manage surface masks https://forums.bohemia.net/forums/topic ... ap-makers/

It apparently uses the "Lossless Fast Pseudo-Quantization Algorithm" by Carsten Klein
https://sourceforge.net/p/freeimage/patches/99/

and they have it set so it's output is always an exported 8bit LZW TIF

On smaller images it can cope with converting 24bit down to 8bit itself, but because my image was much larger I discovered it could only cope if I input exactly 8bit (it's native export depth).

So the only current fix is reducing 256 colours via irfanview - My remaining query is why irfanview & Photoshop both add all that colourmap buffering not technically required? which imagemagick typically strips out.

if you look at the settings in irfanview:
https://imgur.com/a/RnPab
It does mention it's using - Floyd-Steinberg dithering (for max. 256 colours)

not sure if that is even relevant?

Re: Issues converting to 8bit Tif

Posted: 2018-01-25T02:16:35-07:00
by snibgo
As there is no colour reduction, dithering isn't relevant here.

Using a colormap of just four entries instead of 256 means the map is smaller, but more importantly only 2 bits are needed per pixel instead of 8. When you have 1.7G pixels, this is worth saving.

IrfanView can read 2-bit palette files and write them as 8-bit, so that seems a clean solution:

Code: Select all

i_view64.exe in.tif /convert=out.tif