Possible bug with "-remap"

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Posts: 13
Joined: 2018-07-28T12:00:45-07:00
Authentication code: 1152
Location: Germany

Possible bug with "-remap"

Post by Lecram » 2018-07-31T02:40:40-07:00

Code: Select all

ImageMagick 6.9.7-4 Q16 x86_64 20170114
Ubuntu 17.10
4.13.0-46-generic x86_64
When converting a 16 bpp grayscale image into a 8 bpp grayscale image with -remap using a palette of 256 distinct shades of gray, the resulting image is only made up of no more than 64 distinct shades of gray.

The expected behavior would be the creation of an image using the full range of shades supplied by the palette.

Code to reproduce:

Code: Select all


# Create high color depth test image
convert -size 256x512 gradient:"black-white" "bw-gradient-int_16.png"

# Create a palette for conversion/reduction to 256 shades of gray
convert -size 256x1 gradient:"black-white" "palette.png"

# Reduce the depth from 16 to 8 bits using the palette
convert "bw-gradient-int_16.png" -remap "palette.png" -dither FloydSteinberg -depth 8 "bw-gradient-int_8.png"

# Determine the amount of distinct colors in the resulting image
convert "bw-gradient-int_8.png" -format %[k] info:
Please see this thread for further reference.

Post Reply