Skip to content

Commit

Permalink
Merge pull request #84 from sebb-oh/patch-2
Browse files Browse the repository at this point in the history
Image format support for Basler Pylon
  • Loading branch information
fk3 authored Jul 17, 2024
2 parents eff6e5a + 9a751de commit 30c3d4d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Camera-Basler_pylon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def set_GUIparameter(self) -> dict: # noqa: N802
# "GainAuto": ["Off"], # not needed
# "ExposureAuto": ["Off"], # not needed
"PixelFormat": "",
"FileFormat": ["jpeg", "png"],
"FileFormat": ["jpeg", "png", "bmp", "tiff", "raw"],
"Gamma": 1,
"ExposureTime": 10,
"Gain": 1,
Expand Down Expand Up @@ -216,7 +216,16 @@ def measure(self) -> None:
img.AttachGrabResultBuffer(grab_result)

# Save the image data.
img.Save(pylon.ImageFileFormat_Jpeg, self.save_path)
if self.file_format == "jpeg":
img.Save(pylon.ImageFileFormat_Jpeg, self.save_path)
elif self.file_format == "png":
img.Save(pylon.ImageFileFormat_Png, self.save_path)
elif self.file_format == "bmp":
img.Save(pylon.ImageFileFormat_Bmp, self.save_path)
elif self.file_format == "tiff":
img.Save(pylon.ImageFileFormat_Tiff, self.save_path)
elif self.file_format == "raw":
img.Save(pylon.ImageFileFormat_Raw, self.save_path)
else:
print("Error: ", grab_result.ErrorCode, grab_result.ErrorDescription)
grab_result.Release()
Expand Down

0 comments on commit 30c3d4d

Please sign in to comment.