Skip to content

Accept grayscale JPEGs with non-1x1 sampling factors - #99

Open
illwieckz wants to merge 3 commits into
masterfrom
illwieckz/normalize-jpg-sample
Open

Accept grayscale JPEGs with non-1x1 sampling factors#99
illwieckz wants to merge 3 commits into
masterfrom
illwieckz/normalize-jpg-sample

Conversation

@illwieckz

@illwieckz illwieckz commented Aug 5, 2026

Copy link
Copy Markdown
Member

Accept grayscale JPEGs with non-1x1 sampling factors (when loaded by crn_jpgd.cpp)

Some grayscale JPEG files contain non-1x1 sampling factors even though they only have a single luminance component. Treat these as grayscale JPEGs with 1x1 sampling instead of rejecting them.

This fixes loading and converting flr_tmtl_bump.jpg from Xonotic.

Fix #86:

Some grayscale JPEG files contain non-1×1 sampling factors even though
they only have a single luminance component. Treat these as grayscale JPEGs
with 1×1 sampling instead of rejecting them.

This fixes loading and converting flr_tmtl_bump.jpg from Xonotic.
@illwieckz

Copy link
Copy Markdown
Member Author

A simple way to create a test sample is:

convert -size 1x1 xc:gray50 -colorspace Gray -sampling-factor 2x2 -quality 90 gray_bad.jpg

@illwieckz
illwieckz force-pushed the illwieckz/normalize-jpg-sample branch from d7e5aa2 to 40ede6f Compare August 5, 2026 01:37
@illwieckz illwieckz added the enhancement New feature or request label Aug 5, 2026
@illwieckz
illwieckz force-pushed the illwieckz/normalize-jpg-sample branch 3 times, most recently from dc152f2 to d26c7d4 Compare August 5, 2026 02:25
@illwieckz

illwieckz commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

I added test samples to the test suite.

@illwieckz
illwieckz force-pushed the illwieckz/normalize-jpg-sample branch 2 times, most recently from 9985489 to 0380e78 Compare August 5, 2026 03:02
@illwieckz illwieckz mentioned this pull request Aug 5, 2026
@illwieckz
illwieckz force-pushed the illwieckz/normalize-jpg-sample branch 4 times, most recently from 2379243 to 4f450d2 Compare August 7, 2026 02:00
@illwieckz illwieckz changed the title crn_jpgd: accept grayscale JPEGs with non-1x1 sampling factors Accept grayscale JPEGs with non-1x1 sampling factors Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crunch fails to read the Xonotic JPG file flr_tmtl_bump.jpg

1 participant