File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -255,18 +255,16 @@ py::bytes
255255ImageBuf_repr_png (const ImageBuf& self)
256256{
257257 ImageSpec original_spec = self.spec ();
258- ImageSpec new_spec (
259- original_spec.width ,
260- original_spec.height ,
261- original_spec.nchannels ,
262- TypeDesc::UINT8
263- );
258+
259+ if (original_spec.width < 1 || original_spec.height < 1 ) {
260+ return py::bytes ();
261+ }
264262
265263 std::vector<unsigned char > file_buffer; // bytes will go here
266264 Filesystem::IOVecOutput file_vec (file_buffer); // I/O proxy object
267265
268266 std::unique_ptr<ImageOutput> out = ImageOutput::create (" temp.png" , &file_vec);
269- out->open (" temp.png" , new_spec );
267+ out->open (" temp.png" , original_spec );
270268 self.write (out.get ());
271269 out->close ();
272270
You can’t perform that action at this time.
0 commit comments