mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Fix saving grayscale WebP images (#2591)
This commit is contained in:
parent
c9a25fda0a
commit
1de7924694
@ -76,7 +76,7 @@ namespace dlib
|
||||
auto data = reinterpret_cast<const uint8_t*>(image_data(img));
|
||||
const int width = img.nc();
|
||||
const int height = img.nr();
|
||||
const int stride = width_step(img);
|
||||
int stride = width_step(img);
|
||||
if (pixel_traits<pixel_type>::rgb_alpha)
|
||||
{
|
||||
if (pixel_traits<pixel_type>::bgr_layout)
|
||||
@ -94,8 +94,10 @@ namespace dlib
|
||||
else
|
||||
{
|
||||
// This is some other kind of color image so just save it as an RGB image.
|
||||
// We also need to recompute the stride in case we were given a grayscale image.
|
||||
array2d<rgb_pixel> temp;
|
||||
assign_image(temp, img);
|
||||
stride = width_step(temp);
|
||||
auto data = reinterpret_cast<const uint8_t*>(image_data(temp));
|
||||
impl::impl_save_webp(filename, data, width, height, stride, quality, impl::webp_type::rgb);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ New Features and Improvements:
|
||||
Non-Backwards Compatible Changes:
|
||||
|
||||
Bug fixes:
|
||||
- Fix saving grayscale WebP images (PR #2591)
|
||||
</current>
|
||||
|
||||
<!-- ************************************************************************************** -->
|
||||
|
Loading…
Reference in New Issue
Block a user