[SOLVED] Create 8bit non-palletized greyscale TGA or BMP

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MrMaxP
Posts: 2
Joined: 2015-10-12T00:55:12-07:00
Authentication code: 1151

[SOLVED] Create 8bit non-palletized greyscale TGA or BMP

Post by MrMaxP »

I need to convert a 24 bit png to greyscale and save it as TGA or BMP with 8bpp no palette.

I'm using

Code: Select all

convert source.png -grayscale Lightness -colors 256 -compress None dest.tga
which converts the image correctly and does save as 8bpp, but it uses a palette. No matter what I try I can't seem to get a true grey-scale in the data instead of a palletized image.

Is there a way to force this? I'm happy to use another image format if this can't be done with TGA or BMP. My only requirement is that the format is simple enough to read easily with python without the use of external libraries (Not using PIL for example or any other dependencies apart from a my python script and the convert exe). I just need to load the raw uncompressed grey-scale image data as a byte array in python.

Thanks,
Max
Last edited by MrMaxP on 2015-10-12T01:40:28-07:00, edited 2 times in total.
MrMaxP
Posts: 2
Joined: 2015-10-12T00:55:12-07:00
Authentication code: 1151

Re: Create 8bit non-palletized greyscale TGA or BMP

Post by MrMaxP »

As if by magic, (ImageMagic that is), while looking up something completely different I found exactly what I was looking for in the documentation.

I've added

-type GrayScale -depth 8

to my parameters and it seems to have done exactly what I wanted.

Thanks,
Max
Post Reply