Re: TIFF to BMP conversion problem

Bob Friesenhahn <[email protected]> Mon, 4 May 2020 08:21:45 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Mon, 4 May 2020, Münkel Heiko wrote:

> Hello,
>
> I want to convert a TIFF file with multi images in it to a series of BMP files. The BMP files must have only 8 Bit grey values, coded with PseudoClass and must be subsampled. Therefore I've used the following commands:
>
>
> 1.     Conversion to PNG, because I didn't find all these flags for BMP files:
>
> gm convert input.tif -colorspace GRAY -colors 256 -define png:bits-per-sample=8 -format png -resize 418x384 +adjoin png8:"output-%03d.png"

What inspires the '-define png:bits-per-sample=8'?  I do not see any 
mention of this in the GM documentation.

Likewise, the GM documentation for -format says that the way you are 
using it only applies to the 'mogrify' command.

The PNG8 writer is suspect.  I think it has a lot of bugs.

Try

gm convert input.tif -resize 418x384 -colorspace GRAY -colors 256 +adjoin png:"output-%03d.png"

This still might not provide the desired pseudoclass image.

> 2.     Conversion to bmp files in a bash for loop:
>
> for f in `ls *.png`; do gm convert $f bmp/${f%.png}.bmp; done
>
> The output of 'gm identify output-000.bmp' now has the information "PseudoClass 256c". That seems to be right. But if I copy these files on a windows system, the image properties in a file manager pointed out, that the file has a bit depth of 32 bit. But I need 8 bit instead. By the way: Is there a command to check this with Graphicsmagick too?

Use this (add +ping) for a more thorough test:

   gm identify +ping output-000.bmp

but first you should verify that your PNG files are actually ok.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help