c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

commit b167baeb3faa78f3a5b9f0e7cf6e197b81ac095b
parent d402e9a855d6e5366000eea2f841119258c2c5ad
Author: Gavin  Peacock <gpeacock@adobe.com>
Date:   Thu,  6 Oct 2022 13:47:19 -0700

create jpeg thumbnails for pngs without alpha (#145)


Diffstat:
Msdk/src/utils/thumbnail.rs | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sdk/src/utils/thumbnail.rs b/sdk/src/utils/thumbnail.rs @@ -31,11 +31,10 @@ pub fn make_thumbnail(path: &std::path::Path) -> Result<(String, Vec<u8>)> { if img.width() > longest_edge || img.height() > longest_edge { img = img.thumbnail(longest_edge, longest_edge); } - - // for png files, use png thumbnails for transparency + // for png files, use png thumbnails if there is an alpha channel // for other supported types try a jpeg thumbnail let (output_format, content_type) = match format { - ImageFormat::Png => (image::ImageOutputFormat::Png, "image/png"), + ImageFormat::Png if img.color().has_alpha() => (image::ImageOutputFormat::Png, "image/png"), _ => ( image::ImageOutputFormat::Jpeg(THUMBNAIL_JPEG_QUALITY), "image/jpeg",