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

Fix: Corrupted JPEG #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix: Corrupted JPEG #68

wants to merge 1 commit into from

Conversation

z65536
Copy link

@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
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.

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.

4 participants