Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added fix to handle dots in filenames properly #33

Merged
merged 1 commit into from
Jun 27, 2024
Merged
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
9 changes: 5 additions & 4 deletions flirimageextractor/flir_image_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,11 @@ def save_images(self, minTemp=None, maxTemp=None, bytesIO=False):
) / (np.amax(self.thermal_image_np) - np.amin(self.thermal_image_np))

if not bytesIO:
thermal_output_filename_array = self.flir_img_filename.split(".")
# use splitext to handle dots in filenames properly.
thermal_output_filename_array = os.path.splitext(self.flir_img_filename)
thermal_output_filename = (
thermal_output_filename_array[0]
+ "_thermal."
+ "_thermal"
+ thermal_output_filename_array[1]
)

Expand All @@ -434,12 +435,12 @@ def save_images(self, minTemp=None, maxTemp=None, bytesIO=False):
transformed_filename = transform_filename_into_directory(
thermal_output_filename, str(palette.name)
)
filename_array = transformed_filename.split(".")
# use splitext to handle dots in filenames properly.
filename_array = os.path.splitext(transformed_filename)
filename = (
filename_array[0]
+ "_"
+ str(palette.name)
+ "."
+ filename_array[1]
)
if self.is_debug:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flirimageextractor"
version = "1.5.5"
version = "1.5.6"
description = "A small tool/lib to read temperatures and original photos from FLIR® thermal camera images."
authors = [
"National Drones <[email protected]>",
Expand Down
Loading