Skip to content

imwrite doesn't handle pbm #9791

@derVedro

Description

@derVedro
System information (version)
  • OpenCV => 3.2.0
  • Operating System / Platform => Ubuntu 16.04
Detailed description

If you try to save some monochrome image as bitmap ( .pbm P1/P4) you get a greymap (P2/P5) picture at outcome.

Steps to reproduce

A simple example:

import numpy as np
import cv2
img = np.array([0, 0, 0, 0]).reshape((2,2))
cv2.imwrite('/tmp/out.pbm', img, (32, 0))

And out.pbm looks like this:

P2
2 2
255
   0   0
   0   0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions