mogrify bmp to jpg failed

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
shaynatp

mogrify bmp to jpg failed

Post by shaynatp »

When I run mogrify -format jpg *bmp it runs with no errors, but the jpg files are blank.
I also tried convert *bmp *jpg and it also results in a blank jpg.
What am I doing wrong?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify bmp to jpg failed

Post by fmw42 »

Recommend you mogrify to a new folder so you don't overwrite your originals. Create a new directory, say test. Cd to the directory holding your images.

mogrify -path /pathto/test -format jpg *.bmp

(see the period in *.bmp)

If that does not work, then perhaps you have some bad bmp files or your IM is too old or corrupt
shaynatp

Re: mogrify bmp to jpg failed

Post by shaynatp »

Thank you, but no that did not work.
I found out that my bmps are 256 color. If I use Paint to convert it to 24-bit, then mogrify -format jpg *bmp works fine. Can you tell me how to convert my bmps from 256 color to 24 bit using IM?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify bmp to jpg failed

Post by fmw42 »

try

convert image.bmp -depth 8 -type truecolor newimage.bmp

see http://www.imagemagick.org/Usage/formats/#bmp for other ways to deal with BMP conversion
shaynatp

Re: mogrify bmp to jpg failed

Post by shaynatp »

This is giving me "convert: invalid colormap index" error.
Here is what prints when I use identify -verbose:

[shayna@kahuna ~]$ identify -verbose TX060078750001.BMP
Image: TX060078750001.BMP
Format: BMP (Microsoft Windows bitmap image)
Class: PseudoClass
Geometry: 512x160
Type: Bilevel
Endianess: Undefined
Colorspace: Gray
Channel depth:
Gray: 1-bits
Channel statistics:
Gray:
Min: 1 (1)
Max: 1 (1)
Mean: 1 (1)
Standard deviation: 0 (0)
Colors: 2
Histogram:
81920: (255,255,255) white
Rendering intent: Undefined
Resolution: 25.6x25.6
Units: PixelsPerCentimeter
Filesize: 5.4kb
Interlace: None
Background color: white
Border color: #DFDFDF
Matte color: grey74
Page geometry: 512x160+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Signature: 8e6f77366baf8f9b9cddc873765484b539c202d890ef8291302eae35e63b37ce
Tainted: False
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html


Why is it saying invalid colormap index?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify bmp to jpg failed

Post by fmw42 »

I don't see that error message?

But you are using a very old version of IM. IM is now at 6.5.7-7 (so you are nearly 300 versions old). I would strongly recommend that you upgrade.

Post a link to one of your images so others can see if it works better with a more current IM or the IM folks can analyze your image.
shaynatp

Re: mogrify bmp to jpg failed

Post by shaynatp »

Thank you, but I don't have a link to my bmp and I am unable to update IM (but I will suggest it to my company). I created a workaround that pretty much fixed the problem. First I filled the 8 bytes from offset 46 to 53 (0x2e-0x35) which is "number of colors" with 0. Then I was able to use mogrify -format jpg *bmp without error. Editing "number of colors" did create some color problems, but since these are black and white anyway, I just used mogrify -monochrome *bmp. Not exactly the best way to do this, I know, but it works.
Post Reply