Page 1 of 1

Converting raw greyscale BMP image

Posted: 2013-03-19T04:15:38-07:00
by myicq
I have some raw BMPs I would like to have converted to BMPs with header.
I know the size of each data, and I know that each image contains 256 different colors

Example file is here: http://ge.tt/8DniNXb/v/0

Both original (.raw) and converted using paintShopPro. To convert I have selected "greyscale", "interleaved" and size 300 x 119

I have tried to use

Code: Select all

convert -size 300x119 -depth 8 rgb:qwerty.raw  qwertyout.bmp
but I only get "unexpected end of file".

Second part is how I specify a specific pallette for the output. Not a major issue though.

Hope someone can find out how to get from .raw to .bmp as per example in link.

Thanks.

Re: Converting raw greyscale BMP image

Posted: 2013-03-19T06:54:10-07:00
by snibgo
Your link is broken.

Re: Converting raw greyscale BMP image

Posted: 2013-03-19T14:05:33-07:00
by myicq
snibgo wrote:Your link is broken.
Just tried now from a different location. It's not broken.

If you wish the direct download link, this...

Re: Converting raw greyscale BMP image

Posted: 2013-03-19T15:08:20-07:00
by snibgo
I think the "RGB:" format can only handle non-palette images. But if it's a palette image, there's no room in that file for the palette.

The "gray:" format can read the file, but I don't know if the result is correct.

Re: Converting raw greyscale BMP image

Posted: 2013-03-21T07:04:32-07:00
by myicq
The gray: image format did not make any difference..
The file being opened is exactly 35700 bytes, equal to 300 x 118.
It's a headerless BMP file in 8 bit format, one byte = 1 colour.
My attempts so far:

Code: Select all

c:\>convert -size 300x118 -depth 8 rgb:qwerty.raw q3.bmp
convert: Unexpected end-of-file (qwerty.raw).

c:\>convert -size 300x118 gray:qwerty.raw q3.bmp
convert: Unexpected end-of-file (qwerty.raw).

c:\>convert -size 300x118 -depth 1 gray:qwerty.raw q3.bmp
convert: Unexpected end-of-file (qwerty.raw).

c:\>convert -size 300x118 -depth 8 gray:qwerty.raw q3.bmp
convert: Unexpected end-of-file (qwerty.raw).

Re: Converting raw greyscale BMP image

Posted: 2013-03-21T10:05:39-07:00
by snibgo
According to my arithmetic, 35700 = 300x119 (not 118).

Code: Select all

convert -size 300x119 -depth 8 gray:qwerty.raw q3.bmp
This works for me (IM v6.7.9 on Windows 7).

Re: Converting raw greyscale BMP image

Posted: 2015-02-04T04:58:06-07:00
by myicq
snibgo wrote:According to my arithmetic, 35700 = 300x119 (not 118).

Code: Select all

convert -size 300x119 -depth 8 gray:qwerty.raw q3.bmp
This works for me (IM v6.7.9 on Windows 7).
Snibgo - I never thanked you for the solution you gave here. This way works great.

Code: Select all

convert -size  {xsize}x{ysize} -depth 8  gray:{rawfile}   outputfile.bmp
So thumbs up for you!