-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
montage: 8-bit PNG images incorrectly converted into 48-bit PNG images #5041
Comments
Please show your input image, convex-hull-blocks.png. |
It is normal for ImageMagick to make the output depth the Q depth of your compile when new colors are introduced. So if you are on Q16, then he output from some processing would be 16-bits per pixel per channel. I am not sure why your IM 7.1.0.20 is giving 8-bits. That is not typical and was likely corrected in 7.1.0.21. If you want to keep 8-bits, then add -depth 8 to your command line (3x8=24-bit color or use PNG8: for 8-bit color) |
This command will slightly shrink the input, and add a border. Shrinking (by resizing) is re-sampling, which usually adds new colours "between" existing colours. When IM saves a PNG, by default it will use 8 bits/channel/pixel unless that would lose precision. If it would lose precision, it will use 16 bits/channel/pixel. As fmw42 says, use "-depth 8" before the output if you want to force just 8 bits. |
The original image The document says "PNG inheriting subformat from original if possible." |
That is only if you use "PNG00:"
But you haven't use "PNG00:". |
@urban-warrior I tried adding The changelog doesn't say any PNG encoder/decoder changed, so this problem is a software regression. This problem is still represented on IM 7.1.0-31. convex-hull-blocks_7.1.0-20-PNG00.png PNG 128x128 128x128+0+0 8-bit sRGB 7418B 0.000u 0:00.000convex-hull-blocks_7.1.0-21-PNG00.png PNG 128x128 128x128+0+0 16-bit sRGB 29887B 0.000u 0:00.000 |
Its not a bug. The issue has nothing to do with PNG. Instead montage resizes the image with ThumbnailImage(). Previously, your image was at a size that coincidentally was sampled rather than resized. Resizing introduces new colors. The new thumbnail algorithm prefers resizing to theoretically produce "better" thumbnails. Of course, if you simply convert your source image to PNG, you will get an exact replica. |
@urban-warrior |
We will add a patch to clone an image when its resize size is identical to its actual size. That should resolve this issue. |
You can resize (actually sample if you do not want any change in colors) outside montage and pipe the results to montage.
or
|
Make tiff optional (default on, like before) Merged Add support for FITS images with NaN values #5084 Fixes grammar/typos/markdown #5083 Commits prep Beta release d2c4a6f ImageMagick/ImageMagick#3661 9090b17 possible obscure memory leak 8e0c95e check event mask before logging eab8155 check event mask before logging 7dcb276 Also create changelog in the daily build. 878a667 Removed %GITHUB_WORKSPACE% from other builds. 2540c48 improve/optimize logging 7ba113a ImageMagick/ImageMagick#5041 c942d53 need Changelog.md, referenced by web pages 6b6e7f3 ilatest autoconf update 9dfee98 move to wbsite repo 3e445a0 optimize thumbnail resizing 09ab692 ImageMagick/ImageMagick#4533 (comment) d13f844 Rename extent to length. b056cec Allow exif profile that has a zero length (#5082). 0433d6e Moved length check. 267a891 Removed code that was used to create a test image. bf925e6 Use consistent code style. c4c031b revert bca2fb8 Added missing CoderEndianSupportFlag (#5090). 0952c6a Sort commits by date instead. 7b95dda https://oss-fuzz.com/testcase?key=5120317075357696 5622990 Removed unused arguments. c704997 Added missing typecasts. 6820800 check for image width/height exceeding INT_MAX 6d2c75e eliminate compiler exception 8649f4f add comment c506f55 Use set_arg_encoding as suggestion in #5092. 67a2613 optimize logging b2eaec1 fix copyright c2fc57a initalize logging variable 263bfae possible divide by zero dce1bcf more informative exception message b7d240b more informative exception message 354669f make some logging coditional 372b5df ImageMagick/ImageMagick#3859 f49b826 release a2b2c08
@urban-warrior |
ImageMagick version
7.1.0-21
Operating system
Windows
Operating system, version and so on
Windows 11 Pro x64 22000.593
Description
From 7.1.0-21,
montage
converts 8-bit PNG images into 48-bit PNG images with corrupted color.The output images of 7.1.0-20 were 8-bit PNG, the same format as input images.
Steps to Reproduce
7.1.0-20
7.1.0-21
Images
convex-hull-blocks_7.1.0-20.png
convex-hull-blocks_7.1.0-21.png
The text was updated successfully, but these errors were encountered: