excel - Convert image to BMP 24bit with Imagick at PHP


I need insert image to Excel file with Spreadsheet_Excel_Writer, so I must convert it to BMP 24-bit. I using code:

$preview_file = DIR_CACHE . $productId . '-1.bmp';
$preview = new Imagick(DIR_IMAGE . $row['image']);
$preview->resizeImage(100, 100, imagick::FILTER_UNDEFINED, 1);
$worksheet->insertBitmap( $i, $j++, $preview_file, 0, 0, 1, 1 );

But in Excel image show bugged. I have tried to resave it with Paint and add to Excel - it became good. So, I have compared both files and see: Screenshot

How I can fix this?


Link for result BMPs:

https://dl.dropboxusercontent.com/u/17397112/613-1.bmp https://dl.dropboxusercontent.com/u/17397112/613-2.bmp

Bug in excel showed as:


People are also looking for solutions to the problem: php - PHPCS - Type Hint with alias


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.