Problem with -depth on PNG images

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
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Problem with -depth on PNG images

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with -depth on PNG images

Post by snibgo »

This works fine in v7.0.7-28 (with libpng 1.6.34). Perhaps more recent versions have a bug.
snibgo's IM pages: im.snibgo.com
muccigrosso
Posts: 64
Joined: 2017-10-03T10:39:52-07:00
Authentication code: 1151

Re: Problem with -depth on PNG images

Post by muccigrosso »

Yeah, I do this a lot and the problem just started.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Problem with -depth on PNG images

Post by dlemstra »

Looks like the same issue has been reported and fixed here: https://github.com/ImageMagick/ImageMagick/issues/1343
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply