adding image support for gif and webp (#11237)

Adds image support for gif and webp images. Tested using webp and gif
(both single and multi image gif files)
This commit is contained in:
natea-oai 2026-02-09 14:47:22 -08:00 committed by GitHub
parent 373f5467ef
commit ed977dbeda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 4 deletions

29
codex-rs/Cargo.lock generated
View file

@ -2382,6 +2382,12 @@ dependencies = [
"tracing-error",
]
[[package]]
name = "color_quant"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colorchoice"
version = "1.0.4"
@ -3877,6 +3883,16 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "gif"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5df2ba84018d80c213569363bdcd0c64e6933c67fe4c1d60ecf822971a3c35e"
dependencies = [
"color_quant",
"weezl",
]
[[package]]
name = "gimli"
version = "0.32.3"
@ -4524,6 +4540,9 @@ checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
dependencies = [
"bytemuck",
"byteorder-lite",
"color_quant",
"gif",
"image-webp",
"moxcms",
"num-traits",
"png",
@ -4532,6 +4551,16 @@ dependencies = [
"zune-jpeg 0.5.12",
]
[[package]]
name = "image-webp"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
dependencies = [
"byteorder-lite",
"quick-error",
]
[[package]]
name = "impl-more"
version = "0.1.9"

View file

@ -51,7 +51,7 @@ derive_more = { workspace = true, features = ["is_variant"] }
diffy = { workspace = true }
dirs = { workspace = true }
dunce = { workspace = true }
image = { workspace = true, features = ["jpeg", "png"] }
image = { workspace = true, features = ["jpeg", "png", "gif", "webp"] }
itertools = { workspace = true }
lazy_static = { workspace = true }
pathdiff = { workspace = true }

View file

@ -1540,7 +1540,11 @@ impl ChatComposer {
fn is_image_path(path: &str) -> bool {
let lower = path.to_ascii_lowercase();
lower.ends_with(".png") || lower.ends_with(".jpg") || lower.ends_with(".jpeg")
lower.ends_with(".png")
|| lower.ends_with(".jpg")
|| lower.ends_with(".jpeg")
|| lower.ends_with(".gif")
|| lower.ends_with(".webp")
}
fn trim_text_elements(

View file

@ -9,11 +9,11 @@ workspace = true
[dependencies]
base64 = { workspace = true }
image = { workspace = true, features = ["jpeg", "png"] }
image = { workspace = true, features = ["jpeg", "png", "gif", "webp"] }
codex-utils-cache = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["fs", "rt", "rt-multi-thread", "macros"] }
[dev-dependencies]
image = { workspace = true, features = ["jpeg", "png"] }
image = { workspace = true, features = ["jpeg", "png", "gif", "webp"] }
tempfile = { workspace = true }