Skip to content

Commit

Permalink
Merge pull request libvips#1257 from kleisauke/fix-webp-thumbnail
Browse files Browse the repository at this point in the history
Fix thumbnailing of a WebP image (master)
  • Loading branch information
jcupitt authored Mar 13, 2019
2 parents a663a1b + f40eb5e commit ca7d914
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libvips/resample/thumbnail.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@ vips_thumbnail_file_open( VipsThumbnail *thumbnail, double factor )
{
VipsThumbnailFile *file = (VipsThumbnailFile *) thumbnail;

if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ) {
if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) {
return( vips_image_new_from_file( file->filename,
"access", VIPS_ACCESS_SEQUENTIAL,
"shrink", (int) factor,
Expand All @@ -899,8 +900,7 @@ vips_thumbnail_file_open( VipsThumbnail *thumbnail, double factor )
NULL ) );
}
else if( vips_isprefix( "VipsForeignLoadPdf", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) {
vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ) {
return( vips_image_new_from_file( file->filename,
"access", VIPS_ACCESS_SEQUENTIAL,
"scale", factor,
Expand Down Expand Up @@ -1076,7 +1076,8 @@ vips_thumbnail_buffer_open( VipsThumbnail *thumbnail, double factor )
{
VipsThumbnailBuffer *buffer = (VipsThumbnailBuffer *) thumbnail;

if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ) {
if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) {
return( vips_image_new_from_buffer(
buffer->buf->data, buffer->buf->length, buffer->option_string,
"access", VIPS_ACCESS_SEQUENTIAL,
Expand All @@ -1092,8 +1093,7 @@ vips_thumbnail_buffer_open( VipsThumbnail *thumbnail, double factor )
NULL ) );
}
else if( vips_isprefix( "VipsForeignLoadPdf", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ||
vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) {
vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ) {
return( vips_image_new_from_buffer(
buffer->buf->data, buffer->buf->length, buffer->option_string,
"access", VIPS_ACCESS_SEQUENTIAL,
Expand Down

0 comments on commit ca7d914

Please sign in to comment.