简体   繁体   中英

Imagemagick/convert monochromatic tiff file into monochromatic png file

I have a tiff file that is monochromatic. It's just black and white pixels.

When I use identify (part of imagemagick) I get this output:

filename.tif TIFF 7300x5536 7300x5536+0+0 1-bit Bilevel DirectClass 1.854MB 0.000u 0:00.000

I want to convert this to a png file (to display on the web), so I do convert filename.tif filename.png , however when I identify this file, I get:

1577.png PNG 7300x5536 7300x5536+0+0 8-bit PseudoClass 2c 1.669MB 0.000u 0:00.000

ie it reports as 8-bit image (right?)

How can I force this into a 2 bit image?

My goal is to reduce the filesize as much as possible (without losing quality), and i think that if it's 2 bits per pixel, it'll use less space.

Update : I have already tried the following options (on their own): -depth 2 , -colors 2

Maybe you can try with:

convert -colors 2 filename.tif filename.png

From Imagemagic documentation ( http://www.imagemagick.org/script/command-line-options.php#colors )

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