Writeexcel gem - bitmap image not writing into the spreadsheet

workbook = WriteExcel.new(“images.xls”)
worksheet4 = workbook.add_worksheet(‘Image 1’)
worksheet4.write(‘A10’, “Image inserted over scaled rows and columns.”)
worksheet4.insert_image(‘A1’,
File.join(File.dirname(File.expand_path(FILE)), ‘24bit.bmp’)
)
workbook.close

I am not able to write bitmap image whereas I can import .jpg images
well.

Error i am getting
“isn’t a 24bit true color bitmap.”

Also used this step to convert into true color bitmap
“convert alarm.bmp -type truecolor 24bit.bmp”

Help…

Sathish,
It seems it is reading and verifying bitmap planes and bpp
data
by the following method

data.unpack(“x26 v2”)

The value return by this method should be 24. This is nothing but
bitcount(they were calling like this).

So please check the above method is returning 24. If the value of
bitcount
is 24 then the error will never come.

Regards,
Manivannan

On 17 November 2014 15:55, sathish thandavan
[email protected]

Thanks for the reply.

I am getting planes =1
and bitcount = 24

but the image is not writing in the spreadsheet,instead it is showing as
empty in the sheet. Opening the attachment it shows file corrupted and
same
is working for other file formats(jpg)

Sathish.T