简体   繁体   中英

ImageMagick NOT TO CONVERT PNG bit depth

I have following batch script for adding transparent color to images, it is working nicely for that

for /f %%f in ('dir /b .') do convert %%f -transparent white tra/%%f

However it automatically converts bit-depth of image to 8 bpp or less if applicable. And I don't want that. Tried "-depth 32" and "-define png:bit-depth=value=32" but no luck, imagemagick still converts image to lower bit depth. Any help please?

The "bit depth" in PNG refers to the bits per sample, not bits per pixel. So "-depth 32" would mean 96-bit RGB or 128-bit RGBA, but you'd have to write to an image format that supports such large depth (not PNG, which supports only up to 16 bits/sample).

You can use

convert input_file -transparent white png32:output.png

to get 32-bit RGBA pixels (8 bits per sample), if that's what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM