Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink-on-load broken on v8.8.0-rc1 #1297

Closed
kleisauke opened this issue Apr 27, 2019 · 22 comments
Closed

Shrink-on-load broken on v8.8.0-rc1 #1297

kleisauke opened this issue Apr 27, 2019 · 22 comments

Comments

@kleisauke
Copy link
Member

It seems that the shrink-on-load feature is broken on v8.8.0-rc1:

[kleisauke@PC-KAW ~]$ wget https://eoimages.gsfc.nasa.gov/images/imagerecords/91000/91258/northwestangle_oli_2015263_lrg.jpg
[kleisauke@PC-KAW ~]$ G_MESSAGES_DEBUG=all vipsthumbnail northwestangle_oli_2015263_lrg.jpg --size 300x100 -o test.jpg
VIPS-INFO: 16:56:46.963: thumbnailing northwestangle_oli_2015263_lrg.jpg
VIPS-INFO: 16:56:46.964: selected loader is VipsForeignLoadJpegFile
VIPS-INFO: 16:56:46.964: input size is 10000 x 10000
VIPS-INFO: 16:56:46.964: loading jpeg with factor 1 pre-shrink
VIPS-INFO: 16:56:46.964: pre-shrunk size is 10000 x 10000
VIPS-INFO: 16:56:46.964: converting to processing space srgb
VIPS-INFO: 16:56:46.965: shrinkv by 50
VIPS-INFO: 16:56:46.965: shrinkv sequential line cache
VIPS-INFO: 16:56:46.965: shrinkh by 50
VIPS-INFO: 16:56:46.965: residual reducev by 0.5
VIPS-INFO: 16:56:46.965: reducev: 13 point mask
VIPS-INFO: 16:56:46.966: reducev: using vector path
VIPS-INFO: 16:56:46.966: reducev sequential line cache
VIPS-INFO: 16:56:46.966: residual reduceh by 0.5
VIPS-INFO: 16:56:46.967: reduceh: 13 point mask
VIPS-INFO: 16:56:46.967: thumbnailing northwestangle_oli_2015263_lrg.jpg as ./test.jpg

Possible due to:

if( thumbnail->input_height > thumbnail->page_height ) {

page_height is uninitialized when doing pre-shrink:
/* So page_height is after pre-shrink, but before the main shrink
* stage.
*/
thumbnail->page_height = vips_image_get_page_height( in );

The weird thing is that I couldn't reproduce this on Windows:

C:\vips-dev-8.8\bin>vipsthumbnail northwestangle_oli_2015263_lrg.jpg --size 300x100 -o test.jpg
VIPS-INFO: 18:05:11.060: thumbnailing northwestangle_oli_2015263_lrg.jpg
VIPS-INFO: 18:05:11.068: selected loader is VipsForeignLoadJpegFile
VIPS-INFO: 18:05:11.072: input size is 10000 x 10000
VIPS-INFO: 18:05:11.074: loading jpeg with factor 8 pre-shrink
VIPS-INFO: 18:05:11.078: pre-shrunk size is 1250 x 1250
VIPS-INFO: 18:05:11.081: converting to processing space srgb
VIPS-INFO: 18:05:11.084: shrinkh by 6
VIPS-INFO: 18:05:11.086: residual reduceh by 0.48
VIPS-INFO: 18:05:11.089: reduceh: 13 point mask
VIPS-INFO: 18:05:11.092: thumbnailing northwestangle_oli_2015263_lrg.jpg as .\test.jpg

However, the output seems to be wrong (should be 100x100):

vipsheader test.jpg
test.jpg: 100x1250 uchar, 3 bands, srgb, jpegload

This was found while testing the Windows binaries. The libvips test-suite failed on this line:

assert im.height == 100

@jcupitt
Copy link
Member

jcupitt commented Apr 27, 2019

Argh, it should be fixed now, sorry about that.

thumbnail shrink-on-load still fails for multi-page images, but that's something to fix later.

@kleisauke
Copy link
Member Author

Seems to work now, thanks! Indeed, shrink-on-load fails for multi-page images when a height is specified (because it shrinks the whole height instead of just the page height). See for example these test-cases:

[kleisauke@pc-kaw ~]$ wget http://www.pdf995.com/samples/pdf.pdf
[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] -o test.webp
VIPS-INFO: 10:31:11.659: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 10:31:11.661: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 10:31:11.661: input size is 612 x 3960
VIPS-INFO: 10:31:11.661: loading PDF/SVG with factor 0.0323232 pre-scale
VIPS-INFO: 10:31:11.662: pre-shrunk size is 19 x 125
VIPS-INFO: 10:31:11.662: converting to processing space srgb
VIPS-INFO: 10:31:11.662: premultiplying alpha
VIPS-INFO: 10:31:11.662: residual scale 5.12 x 5.12
VIPS-INFO: 10:31:11.662: unpremultiplying alpha
VIPS-INFO: 10:31:11.663: thumbnailing pdf.pdf[n=-1] as ./test.webp

(vipsthumbnail:31344): Poppler-CRITICAL **: 10:31:11.936: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:31344): Poppler-CRITICAL **: 10:31:11.936: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:31344): VIPS-WARNING **: 10:31:11.936: error in tile 0 x 75

(vipsthumbnail:31344): Poppler-CRITICAL **: 10:31:11.936: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:31344): Poppler-CRITICAL **: 10:31:11.936: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:31344): VIPS-WARNING **: 10:31:11.936: error in tile 0 x 100
vipsthumbnail: unable to thumbnail pdf.pdf[n=-1]
pdfload: unable to load page 3
[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] --size 200x -o test.webp
VIPS-INFO: 10:32:31.876: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 10:32:31.878: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 10:32:31.878: input size is 612 x 3960
VIPS-INFO: 10:32:31.878: loading PDF/SVG with factor 0.326797 pre-scale
VIPS-INFO: 10:32:31.878: pre-shrunk size is 200 x 1290
VIPS-INFO: 10:32:31.878: converting to processing space srgb
VIPS-INFO: 10:32:31.878: premultiplying alpha
VIPS-INFO: 10:32:31.878: unpremultiplying alpha
VIPS-INFO: 10:32:31.879: thumbnailing pdf.pdf[n=-1] as ./test.webp

@jcupitt
Copy link
Member

jcupitt commented Apr 28, 2019

I'd like to get 8.8 out of the door, so I'm inclined to leave this unimplemented for now. Do you think we should add this feature too?

I think autorotate will probably break too.

@kleisauke
Copy link
Member Author

I agree, lets leave this unimplemented for now. It's just a minor issue that I've encountered, and it only happens with PDF files that are explicitly loaded with n=-1 (WebP and GIF images don't support shrink-on-load).

A quick solution would be to skip shrink-on-load for multi-page images.

@kleisauke
Copy link
Member Author

Indeed, shrink-on-load fails for multi-page images when a height is specified (because it shrinks the whole height instead of just the page height).

After further testing, this assumption appears to be incorrect:

Details
[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] --size x200 -o test.jpg
VIPS-INFO: 12:28:10.915: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 12:28:10.917: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 12:28:10.917: input size is 612 x 3960
VIPS-INFO: 12:28:10.917: loading PDF/SVG with factor 0.0505051 pre-scale
VIPS-INFO: 12:28:10.918: pre-shrunk size is 30 x 200
VIPS-INFO: 12:28:10.918: converting to processing space srgb
VIPS-INFO: 12:28:10.918: premultiplying alpha
VIPS-INFO: 12:28:10.918: residual scale 5 x 5
VIPS-INFO: 12:28:10.919: unpremultiplying alpha
VIPS-INFO: 12:28:10.919: thumbnailing pdf.pdf[n=-1] as ./test.jpg
[kleisauke@pc-kaw ~]$ vipsheader test.jpg
test.jpg: 150x1000 uchar, 3 bands, srgb, jpegload
[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] --size x200 -o test.gif
VIPS-INFO: 12:28:54.594: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 12:28:54.596: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 12:28:54.596: input size is 612 x 3960
VIPS-INFO: 12:28:54.596: loading PDF/SVG with factor 0.0505051 pre-scale
VIPS-INFO: 12:28:54.597: pre-shrunk size is 30 x 200
VIPS-INFO: 12:28:54.597: converting to processing space srgb
VIPS-INFO: 12:28:54.597: premultiplying alpha
VIPS-INFO: 12:28:54.597: residual scale 5 x 5
VIPS-INFO: 12:28:54.597: unpremultiplying alpha
VIPS-INFO: 12:28:54.597: thumbnailing pdf.pdf[n=-1] as ./test.gif
[kleisauke@pc-kaw ~]$ vipsheader test.gif
test.gif: 150x200 uchar, 3 bands, srgb, gifload

However, it will break when writing to animated WebP:

Details
[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] --size x200 -o test.webp
VIPS-INFO: 12:32:03.871: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 12:32:03.873: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 12:32:03.873: input size is 612 x 3960
VIPS-INFO: 12:32:03.873: loading PDF/SVG with factor 0.0505051 pre-scale
VIPS-INFO: 12:32:03.874: pre-shrunk size is 30 x 200
VIPS-INFO: 12:32:03.874: converting to processing space srgb
VIPS-INFO: 12:32:03.874: premultiplying alpha
VIPS-INFO: 12:32:03.874: residual scale 5 x 5
VIPS-INFO: 12:32:03.875: unpremultiplying alpha
VIPS-INFO: 12:32:03.875: thumbnailing pdf.pdf[n=-1] as ./test.webp

(vipsthumbnail:8852): Poppler-CRITICAL **: 12:32:04.154: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:8852): Poppler-CRITICAL **: 12:32:04.154: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:8852): VIPS-WARNING **: 12:32:04.154: error in tile 0 x 120

(vipsthumbnail:8852): Poppler-CRITICAL **: 12:32:04.154: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:8852): Poppler-CRITICAL **: 12:32:04.154: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:8852): VIPS-WARNING **: 12:32:04.154: error in tile 0 x 160
vipsthumbnail: unable to thumbnail pdf.pdf[n=-1]
pdfload: unable to load page 3
pdfload: unable to load page 4

@kleisauke
Copy link
Member Author

I found a fix:

--- libvips/foreign/pdfload.c
+++ libvips/foreign/pdfload.c
@@ -278,6 +278,9 @@
 		return( -1 ); 
 	}
 
+	if (pdf->scale != 1.0)
+		pdf->scale *= pdf->n;
+
 	/* Lay out the pages in our output image.
 	 */
 	if( !(pdf->pages = VIPS_ARRAY( pdf, pdf->n, VipsRect )) )

This multiplies the amount of scale by the number of pages to be loaded. Before this patch:

[kleisauke@pc-kaw ~]$ vips copy pdf.pdf[n=-1,scale=0.0505051] test.jpg

(vips:28877): Poppler-CRITICAL **: 14:08:48.654: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vips:28877): Poppler-CRITICAL **: 14:08:48.654: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vips:28877): VIPS-WARNING **: 14:08:48.654: error in tile 0 x 40
pdfload: unable to load page 1

After:

[kleisauke@pc-kaw ~]$ vips copy pdf.pdf[n=-1,scale=0.0505051] test.jpg
[kleisauke@pc-kaw ~]$ vipsheader test.jpg
test.jpg: 154x1000 uchar, 3 bands, srgb, jpegload

Writing to an animated WebP now also seems to work:

[kleisauke@pc-kaw ~]$ G_MESSAGES_DEBUG=all vipsthumbnail pdf.pdf[n=-1] --size x200 -o test.webp
VIPS-INFO: 14:11:38.818: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 14:11:38.820: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 14:11:38.820: input size is 612 x 3960
VIPS-INFO: 14:11:38.820: loading PDF/SVG with factor 0.0505051 pre-scale
VIPS-INFO: 14:11:38.821: pre-shrunk size is 154 x 1000
VIPS-INFO: 14:11:38.821: converting to processing space srgb
VIPS-INFO: 14:11:38.821: premultiplying alpha
VIPS-INFO: 14:11:38.821: unpremultiplying alpha
VIPS-INFO: 14:11:38.821: thumbnailing pdf.pdf[n=-1] as ./test.webp

(notice the pre-shrunk size is 154 x 1000 instead of the old 30 x 200)

@jcupitt
Copy link
Member

jcupitt commented Apr 29, 2019

Nice! But I think it should go into vips_thumbnail_open() instead -- this doesn't really fit in the loader.

Thumbnail open needs a bit of reorganising :(

@kleisauke
Copy link
Member Author

Indeed, a neater place would be to move this logic to thumbnail.c. I tried this patch:

Details
--- libvips/resample/thumbnail.c
+++ libvips/resample/thumbnail.c
@@ -476,9 +476,17 @@
 		factor = 1.0 / 
 			vips_thumbnail_calculate_common_shrink( thumbnail, 
 				thumbnail->input_width, 
-				thumbnail->input_height );
+				thumbnail->input_height ) * thumbnail->n_pages;
 
-		g_info( "loading PDF/SVG with factor %g pre-scale", factor ); 
+		g_info( "loading PDF with factor %g pre-scale", factor ); 
+	}
+	else if( vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ) {
+		factor = 1.0 /
+			vips_thumbnail_calculate_common_shrink( thumbnail,
+				thumbnail->input_width,
+				thumbnail->input_height );
+
+		g_info( "loading SVG with factor %g pre-scale", factor );
 	}
 	else if( vips_isprefix( "VipsForeignLoadHeif", thumbnail->loader ) ) {
 		/* 'factor' is a gboolean which enables thumbnail load instead

But that will fail if you thumbnail a single page (thumbnail->n_pages contains the pages in the image rather than how many the user wants to load).

By the way,
Could there be a problem in the write_webp_anim function?

It gives Poppler and tile errors when doing vipsthumbnail pdf.pdf[n=-1] --size x900 -o test.webp. However, it does work when thumbnailing the PDF to GIF (animated), JPEG or PNG.

Non-animated WebP seems also to work (with this patch):

Details
--- libvips/foreign/vips2webp.c
+++ libvips/foreign/vips2webp.c
@@ -373,10 +373,10 @@
 {
 	int page_height = vips_image_get_page_height( image ); 
 
-	if( page_height < image->Ysize )
+	/*if( page_height < image->Ysize )
 		return( write_webp_anim( write, image, page_height ) );
-	else
-		return( write_webp_single( write, image ) );
+	else*/
+	return( write_webp_single( write, image ) );
 }
 
 static void

I could open a new issue, if you want.

jcupitt added a commit that referenced this issue Apr 29, 2019
shrink-on-load should now work for multipage PDF thumbnailing

see #1297
@jcupitt
Copy link
Member

jcupitt commented Apr 29, 2019

I think I've fixed it. I tried to make the logic simpler too. Making an anim gif of a large PDF is surprisingly fast!

I'll have a look at webp write.

@jcupitt
Copy link
Member

jcupitt commented Apr 29, 2019

It seems to work with webp as well:

john@yingna ~/pics $ vipsthumbnail nipguide.pdf[n=-1] -s x900 -o x.webp
john@yingna ~/pics $ vips copy x.webp[n=-1] x.gif
john@yingna ~/pics $ eog x.gif

And the image looks OK.

@jcupitt
Copy link
Member

jcupitt commented Apr 29, 2019

I reenabled webp shrink-on-load as well. This fails:

vipsthumbnail dancing_banana2.lossless.webp[n=-1] -o x.gif --vips-info

But only because this also fails:

vips copy dancing_banana2.lossless.webp[shrink=4] x.png

ie. shrink-on-load is broken in webpload for animated webp images.

@kleisauke
Copy link
Member Author

Thanks! Specifying a height of 900 works now. I tried some other dimensions, it looks like it's breaking at x500 now. :(

See:

[kleisauke@pc-kaw ~]$ wget http://www.pdf995.com/samples/pdf.pdf
[kleisauke@pc-kaw ~]$ vipsthumbnail pdf.pdf[n=-1] -s x500 -o x.webp --vips-info
VIPS-INFO: 19:37:19.472: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 19:37:19.474: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 19:37:19.474: input size is 612 x 3960
VIPS-INFO: 19:37:19.474: loading PDF with factor 0.631313 pre-scale
VIPS-INFO: 19:37:19.475: pre-shrunk size is 386 x 2495
VIPS-INFO: 19:37:19.475: converting to processing space srgb
VIPS-INFO: 19:37:19.475: premultiplying alpha
VIPS-INFO: 19:37:19.475: residual scale 1.002 x 1.002
VIPS-INFO: 19:37:19.475: unpremultiplying alpha
VIPS-INFO: 19:37:19.475: thumbnailing pdf.pdf[n=-1] as ./x.webp

(vipsthumbnail:22001): Poppler-CRITICAL **: 19:37:19.833: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:22001): Poppler-CRITICAL **: 19:37:19.833: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:22001): VIPS-WARNING **: 19:37:19.833: error in tile 0 x 1497

(vipsthumbnail:22001): Poppler-CRITICAL **: 19:37:19.833: int poppler_document_get_n_pages(PopplerDocument*): assertion 'POPPLER_IS_DOCUMENT (document)' failed

(vipsthumbnail:22001): Poppler-CRITICAL **: 19:37:19.833: PopplerPage* poppler_document_get_page(PopplerDocument*, int): assertion '0 <= index && index < poppler_document_get_n_pages (document)' failed

(vipsthumbnail:22001): VIPS-WARNING **: 19:37:19.833: error in tile 0 x 1996
vipsthumbnail: unable to thumbnail pdf.pdf[n=-1]
pdfload: unable to load page 3
pdfload: unable to load page 4

Also, does vips_thumbnail_get_tiff_pyramid still works? I think it's necessary to iterate until VIPS_META_N_PAGES instead of the pages in the current image.

for( i = 0; i < thumbnail->n_pages; i++ ) {

Regarding shrink-on-load for animated webp images, perhaps we could disable the shrink option within webp2vips.c if it detects whether the image is animated.

@jcupitt
Copy link
Member

jcupitt commented Apr 30, 2019

Huh that's wierd. It should shrink-on-load to exactly the correct size. I'll have a look.

jcupitt added a commit that referenced this issue Apr 30, 2019
We were doing simple round down for page size with @scale param. But
this makes it very sensitive to rounding errors, so do rint() instead.

vips-resize() does rint() on the output size as well for the same
reason.

See #1297 (comment)
@jcupitt
Copy link
Member

jcupitt commented Apr 30, 2019

pdf shrink-on-load was rounding image size down instead of rounding to nearest, so it was very sensitive to rounding errors. It seems to work now:

$ vipsthumbnail pdf.pdf[n=-1] -s x500 -o x.webp --vips-info 
VIPS-INFO: 16:08:14.968: thumbnailing pdf.pdf[n=-1]
VIPS-INFO: 16:08:14.982: selected loader is VipsForeignLoadPdfFile
VIPS-INFO: 16:08:14.982: input size is 612 x 3960
VIPS-INFO: 16:08:14.982: loading PDF with factor 0.631313 pre-scale
VIPS-INFO: 16:08:15.010: pre-shrunk size is 386 x 2500
VIPS-INFO: 16:08:15.010: converting to processing space srgb
VIPS-INFO: 16:08:15.010: premultiplying alpha
VIPS-INFO: 16:08:15.010: unpremultiplying alpha
VIPS-INFO: 16:08:15.010: thumbnailing pdf.pdf[n=-1] as ./x.webp

@jcupitt
Copy link
Member

jcupitt commented Apr 30, 2019

I think vips_thumbnail_get_tiff_pyramid() is OK -- it needs to discover all the layers in the current image so as to be able to pick the best for shrink-on-load. Layers which have been removed are not useful :(

It should pick a layer >=200% larger than the target size, which I think it's not doing.

@jcupitt
Copy link
Member

jcupitt commented Apr 30, 2019

Simple demo of the webp shrink-on-load issues:

$ vips copy dancing_banana2.lossless.webp[n=-1,shrink=15] x.png

x

@jcupitt
Copy link
Member

jcupitt commented May 1, 2019

Phew, it seems to all work now, for animated webp too. I'll close.

@jcupitt jcupitt closed this as completed May 1, 2019
@kleisauke
Copy link
Member Author

I finally found some time to test this, it seems to be working now. Thanks!

#839 can also be closed, I think.

@kleisauke
Copy link
Member Author

I think vips_thumbnail_get_tiff_pyramid() is OK -- it needs to discover all the layers in the current image so as to be able to pick the best for shrink-on-load. Layers which have been removed are not useful

It seems shrink-on-load is broken for pyramidal tiff images:

[kleisauke@pc-kaw fixtures]$ wget http://merovingio.c2rmf.cnrs.fr/iipimage/PalaisDuLouvre.tif
[kleisauke@pc-kaw fixtures]$ vipsthumbnail PalaisDuLouvre.tif -s 500x -o tn_%s.jpg
[kleisauke@pc-kaw fixtures]$ vipsheader tn_PalaisDuLouvre.jpg 
tn_PalaisDuLouvre.jpg: 500x104 uchar, 3 bands, srgb, jpegload

That should produce a 500x103 image, see:

[kleisauke@pc-kaw fixtures]$ vipsheader PalaisDuLouvre.tif[page=3]
PalaisDuLouvre.tif: 500x103 uchar, 3 bands, srgb, tiffload

I also tried to load all pages explicitly (to ensure vips_thumbnail_get_tiff_pyramid works), but that doesn't seem to work either:

[kleisauke@pc-kaw fixtures]$ vipsthumbnail PalaisDuLouvre.tif[n=-1] -s 500x -o tn_%s.jpg
vipsthumbnail: unable to thumbnail PalaisDuLouvre.tif[n=-1]
tiff2vips: page 1 differs from page 0

(I could open a new issue, if you want)

jcupitt added a commit that referenced this issue Jun 19, 2019
thumbnail was not testing pyramidal tiff images for pyramidness correctly.

see #1297
@jcupitt
Copy link
Member

jcupitt commented Jun 19, 2019

Oooop!! You're right, adding thumbnail of PDF and GIF had broken thumbnail of pyramid.

I now see:

$ vipsthumbnail PalaisDuLouvre.tif -s 500x --vips-info
VIPS-INFO: 17:55:55.658: thumbnailing PalaisDuLouvre.tif
VIPS-INFO: 17:55:55.659: selected loader is VipsForeignLoadTiffFile
VIPS-INFO: 17:55:55.659: input size is 4000 x 828
VIPS-INFO: 17:55:55.664: loading pyr level 3
VIPS-INFO: 17:55:55.664: pre-shrunk size is 500 x 103
VIPS-INFO: 17:55:55.664: converting to processing space srgb
VIPS-INFO: 17:55:55.664: thumbnailing PalaisDuLouvre.tif as ./tn_PalaisDuLouvre.jpg

@jcupitt
Copy link
Member

jcupitt commented Jun 20, 2019

And thank you for reporting this! It'll be in 8.8.1.

@kleisauke
Copy link
Member Author

Seems to work now, thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants