Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cpp/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ PYBIND11_MODULE(image, m)
.def(py::init<int, int, image::format_enum>(), py::arg("iwidth"), py::arg("iheight"), py::arg("iformat"))
.def("bytes_per_row", &image::bytes_per_row)
// .def("const_data", &image::const_data)
#if HAS_VERSION(25, 1)
.def("copy", &image::copy)
#else
.def("copy", &image::copy, py::arg("rect") = rect())
#endif
.def("data", &data)
.def("set_data", &set_data)
.def("format", &image::format)
Expand Down
5 changes: 2 additions & 3 deletions src/poppler/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

from poppler.cpp import image
from poppler.rectangle import Rectangle


class Image:
Expand Down Expand Up @@ -47,8 +46,8 @@ def bytes_per_row(self):
def const_data(self):
return self._image.data()

def copy(self, rect=None):
image = self._image.copy(rect or Rectangle()._rect)
def copy(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how sure are we that no consumer used the rect argument (even if never implemented by the underlying library)?

If we're not sure, we'll have to keep the argument around (emitting a warning when it's non-None, maybe?)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those would have been good questions by upsteam to ask themselves before making a breaking change.

But FWIW they made the choice to remove the parameter without backward compatibility.

image = self._image.copy()
return Image.from_object(image)

@property
Expand Down
Loading