Creating a 24-bit 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
zombie_nation

Creating a 24-bit BMP

Post by zombie_nation »

Hi I am using IM to dynamically create a BMP to be used in another PHP module - PEAR Excel Spreadsheet that can only use BMPs.

I have the following commands:

Code: Select all

$aCmd[] = "convert " . $image . ' -resize 170x60 ' . '/home/' . $_SESSION['account_name'] . "/public_html/images/" . $imagename;
    $aCmd[] = "convert " . $image . ' -resize 170x60 ' . '/home/' . $_SESSION['account_name'] . '/public_html/images/kb_logo_web2.bmp';
And it creates a BMP just fine. The problem is that Excel Spreadsheet states either that the BMP is not 24 true colour or that the width exceeds 65kb. I am not asking for any help with Excel Spreadsheet but would like to get some help in understanding how the BMP is created and how to create a format I can use.

Thanks.
Z.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Creating a 24-bit BMP

Post by fmw42 »

You may have to use Q32 IM compile to save images as 24bits as images in IM are stored to the bit depth of the compile (or less using -depth). But hopefully the IM folks will reply with more details or corrections here.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Creating a 24-bit BMP

Post by el_supremo »

The BMP coder will, by default, output the most recent form of a bitmap header.
But you can force the coder to produce one of two earlier versions by prefixing the output filename with either "bmp3:" or "bmp2:" - e.g. 'bmp3:/public_html/images/kb_logo_web2.bmp'

Pete
Post Reply