Skip to content

Fix: Corrupted JPEG #68

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

Merged
merged 2 commits into from
Feb 21, 2025
Merged

Fix: Corrupted JPEG #68

merged 2 commits into from
Feb 21, 2025

Conversation

z65536
Copy link
Contributor

@z65536 z65536 commented Nov 23, 2024

Calculate the data length from the SOI (Start of Image) and EOI (End of Image) markers in the JPEG data sent by the ESP32.
Add error detection for JPEG data.

@RamesTheGeneric RamesTheGeneric self-requested a review December 5, 2024 22:53
)
if image is None:
try:
image = np.array(Image.open(BytesIO(jpeg)))
Copy link
Contributor

@RamesTheGeneric RamesTheGeneric Dec 5, 2024

Choose a reason for hiding this comment

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

Seems to work as expected although is there a reason why imdecode was replaced with a method from pillow? Replacing that line with the old imdecode method seems to still work fine and avoids another dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

imdecode can sometimes return corrupted data, but it rarely happens, so prioritizing dependencies should be fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose, seems like we're already importing pillow in other files anyways.

@dfgHiatus dfgHiatus added enhancement New feature or request bug Something isn't working labels Jan 17, 2025
@CLAassistant
Copy link

CLAassistant commented Feb 2, 2025

CLA assistant check
All committers have signed the CLA.

@SummerSigh
Copy link
Member

Aproved, thanks

@SummerSigh SummerSigh merged commit 8760fb9 into Project-Babble:main Feb 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants