[GH-ISSUE #439] How to insert image data of type CV:: Mat #343

Closed
opened 2026-05-05 12:10:46 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @ZRBzrb6119 on GitHub (Apr 18, 2024).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/439

Originally assigned to: @jmcnamara on GitHub.

The byte data of type CV:: Mat seems to fail the image type verification
if (memcmp(&signature[1], "PNG", 3) == 0) { if (_process_png(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (signature[0] == 0xFF && signature[1] == 0xD8) { if (_process_jpeg(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (memcmp(signature, "BM", 2) == 0) { if (_process_bmp(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (memcmp(signature, "GIF8", 4) == 0) { if (_process_gif(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else { LXW_WARN_FORMAT1("worksheet image insertion: " "unsupported image format for: %s.", image_props->filename); return LXW_ERROR_IMAGE_DIMENSIONS; }

Originally created by @ZRBzrb6119 on GitHub (Apr 18, 2024). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/439 Originally assigned to: @jmcnamara on GitHub. The byte data of type CV:: Mat seems to fail the image type verification ` if (memcmp(&signature[1], "PNG", 3) == 0) { if (_process_png(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (signature[0] == 0xFF && signature[1] == 0xD8) { if (_process_jpeg(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (memcmp(signature, "BM", 2) == 0) { if (_process_bmp(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else if (memcmp(signature, "GIF8", 4) == 0) { if (_process_gif(image_props) != LXW_NO_ERROR) return LXW_ERROR_IMAGE_DIMENSIONS; } else { LXW_WARN_FORMAT1("worksheet image insertion: " "unsupported image format for: %s.", image_props->filename); return LXW_ERROR_IMAGE_DIMENSIONS; } `
gitea-mirror 2026-05-05 12:10:47 -06:00
Author
Owner

@jmcnamara commented on GitHub (Apr 18, 2024):

Some questions:

  • Is the image type in the buffer actually supported by libxlsxwriter/Excel?
  • If so what happens if you dump the image to a file and then create a simple hello world program that inserts the image from the file (not buffer)?
  • Could you attach a sample image that is failing?
<!-- gh-comment-id:2063381798 --> @jmcnamara commented on GitHub (Apr 18, 2024): Some questions: - Is the image type in the buffer actually supported by libxlsxwriter/Excel? - If so what happens if you dump the image to a file and then create a simple hello world program that inserts the image from the file (not buffer)? - Could you attach a sample image that is failing?
Author
Owner

@jmcnamara commented on GitHub (Apr 28, 2024):

Closing due to lack of feedback. I will reopen with a working example or if the questions above are answered.

<!-- gh-comment-id:2081612672 --> @jmcnamara commented on GitHub (Apr 28, 2024): Closing due to lack of feedback. I will reopen with a working example or if the questions above are answered.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#343
No description provided.