Lift 79 bytes restriction for tEXt chunk payload
cikkle opened this issue · comments
encode/text.rs is testing that the embedded text string in tEXt chunks is under 79 bytes for encoding.
if self.key.as_bytes().is_empty() || self.val.as_bytes().len() > 79 {
return Err(EncoderError::TextSize(self.val.as_bytes().len()));
}
Despite larger strings being discouraged, the PNG spec doesn't set any upper bound on the size of the text string payload when encoding; the hard restriction is only on the length of the keyword.
In my particular use case, (character cards for language model chats), I'm dealing with long runs of base64-encoded json data embedded into png images, and I'm unable to use this crate for this. It'd be best if this restriction was lifted or could be opted out of. The reasoning in the spec for discouraging longer strings is mainly just for the readability of metadata displayed to users.
@cikkle Thanks for opening this issue! Sounds like a good idea to lift that limitation.