Skip to content

Do not disable auto contrast if display_range = 255#163

Merged
Baharis merged 4 commits into
instamatic-dev:mainfrom
Baharis:fix-display
Jun 3, 2026
Merged

Do not disable auto contrast if display_range = 255#163
Baharis merged 4 commits into
instamatic-dev:mainfrom
Baharis:fix-display

Conversation

@Baharis

@Baharis Baharis commented Jun 3, 2026

Copy link
Copy Markdown
Member

For some time, the Instamatic videoframe display (previously VideoStreamFrame.on_frame, currently VideoStreamProcessor.image) did not run auto-scaling whenever display_range was set to 255. The reasoning behind this decision was likely that in such case, the maximum on observed image is 255 and therefore it does not require additional scaling. This thinking is, however, flawed, because you might have an image with 255 range that has lower (or higher, in case of odd behavior) max intensity, and you still need to scale it. This behavior therefore, although intended, behaved as a very odd bug.

Here I remove this condition. With this PR in place, whenever the "autoscaling" is turned on, the image will be always scaled. If the user wants to save on computational power, they can always turn off autoscaling altogether.

Since I consider this to be a simple bug, I will merge that immediately. At best, this change will fix odd behavior for any system that uses 255 scale by default. At worst, it will make image display marginally slower (~53 ms -> ~53.5 ms) for the same users that do not see strange behavior.

Before (wrong scaling, strange colors) After (correct scaling even at 255)
image_15-56-38_079 image_15-56-33_319

@Baharis Baharis self-assigned this Jun 3, 2026
@Baharis Baharis added the bug label Jun 3, 2026
@Baharis Baharis changed the title Do not disable auto_contrast if self.display_range != 255.0 Do not disable auto_contrast if self.display_range != 255 Jun 3, 2026
@Baharis Baharis changed the title Do not disable auto_contrast if self.display_range != 255 Do not disable auto contrast if self.display_range != 255 Jun 3, 2026
@Baharis Baharis changed the title Do not disable auto contrast if self.display_range != 255 Do not disable auto contrast if display_range != 255 Jun 3, 2026
@Baharis Baharis changed the title Do not disable auto contrast if display_range != 255 Do not disable auto contrast if display_range = 255 Jun 3, 2026
@Baharis
Baharis merged commit b4ec6c7 into instamatic-dev:main Jun 3, 2026
6 checks passed
@Baharis
Baharis deleted the fix-display branch June 12, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant