Commit Graph

14 Commits

Author SHA1 Message Date
Andrew Murray
ad42bb3f91
Merge branch 'main' into jpeg-app-segments 2025-10-21 18:18:09 +11:00
eyedav
9527ce7f8c change mode structs to enums
Structs have better type safety, but they make allocation more difficult, especially when we have multiple Python modules trying to share the same code.
2025-07-19 16:54:32 +02:00
Yay295
16fc61ee65 use RawMode struct for jpegmode 2025-07-19 16:00:28 +02:00
eyedav
a12dc30dc0 use mode structs in encode.c and decode.c 2025-07-19 14:46:29 +02:00
Benjamin Gilbert
8053d5e5a0 Allow disabling default emission of JPEG APP0 and APP14 segments
When embedding JPEGs into a container file format, it may be desirable
to minimize JPEG metadata, since the container will include the pertinent
details.  By default, libjpeg emits a JFIF APP0 segment for JFIF-
compatible colorspaces (grayscale or YCbCr) and Adobe APP14 otherwise.
Add a no_default_app_segments option to disable these.

660894cd36 added code to force emission of the JFIF segment if the DPI is
specified, even for JFIF-incompatible colorspaces.  This seems
inconsistent with the JFIF spec, but apparently other software does it
too.  no_default_app_segments does not disable this behavior, since it
only happens when the application explicitly specifies the DPI.
2024-01-08 05:33:12 -06:00
Andrew Murray
2d6ad5868d Use "non-zero" consistently 2024-01-06 12:07:55 +11:00
Benjamin Gilbert
4b422db243 Add keep_rgb option to prevent RGB -> YCbCr conversion during JPEG write
libjpeg automatically converts RGB to YCbCr by default.  Add a keep_rgb
option to disable libjpeg's automatic conversion of RGB images during
write.
2023-12-13 18:26:35 -06:00
Benjamin Gilbert
e572722479 Allow configuring JPEG restart marker interval on save
libjpeg allows specifying the marker interval either in MCU blocks or in
MCU rows.  Support both, via separate parameters, rather than requiring
callers to do the math.

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2023-10-31 17:47:25 -05:00
Andrew Murray
e50ae85ea4 Use jpeg_write_marker to write comment 2022-12-05 13:57:26 +11:00
Andrew Murray
46b7e86bab Format with ClangFormat 2021-01-03 14:17:51 +11:00
Andrew Murray
228301373f Fixed comparison warnings 2020-05-14 06:57:15 +10:00
Andrew Murray
ae43af61da Replaced tabs with spaces 2020-05-01 22:08:57 +10:00
Andrew Murray
a8c0794107 Allow saving of zero quality JPEG images 2020-02-21 22:05:44 +11:00
wiredfool
0bb3f4fee9 source layout reorg 2017-12-28 14:49:47 +00:00