Page 1 of 1

Problem with -depth on PNG images

Posted: 2018-10-15T00:06:38-07:00
by muccigrosso
I'm trying to do a simple reduction of the depth of some grayscale images (of text) that I have. They're in PNG format. When I use a depth of 2 or 3, the entire image gets compressed into the left side of the canvas, leaving the side half black. It only seems to happen with gray PNG files. I can reproduce it via

Code: Select all

magick logo: -colorspace gray -depth 3 logo.png
In this case the image is compressed into the left half of the canvas. If I make the depth 2, then the image is compressed into the leftmost quarter of the canvas. A depth of 1 is fine.

NB If I output to show: as PNG:, I get the same error:

Code: Select all

magick logo: -colorspace gray -depth 3 png:- | display -
Perhaps something with writing to PNG?

Tested OK with jpg and tiff output formats.

MacOS 10.13.6

Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-24 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib fftw fontconfig freetype jbig jng jp2 jpeg lcms ltdl lzma png tiff x xml zlib

Re: Problem with -depth on PNG images

Posted: 2018-10-15T03:52:19-07:00
by snibgo
This works fine in v7.0.7-28 (with libpng 1.6.34). Perhaps more recent versions have a bug.

Re: Problem with -depth on PNG images

Posted: 2018-10-15T08:46:02-07:00
by muccigrosso
Yeah, I do this a lot and the problem just started.

Re: Problem with -depth on PNG images

Posted: 2018-10-15T13:40:39-07:00
by dlemstra
Looks like the same issue has been reported and fixed here: https://github.com/ImageMagick/ImageMagick/issues/1343