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

tif save incomplete #1318

Closed
jindili opened this issue May 29, 2019 · 3 comments
Closed

tif save incomplete #1318

jindili opened this issue May 29, 2019 · 3 comments

Comments

@jindili
Copy link

jindili commented May 29, 2019

using pyvips latest on win7 sp1 64bit
vips version: vips-8.7.4-Fri Jan 18 12:51:47 UTC 2019

pyvips code:

import os
import pyvips

# change to the directory of shape.pdf
os.chdir(r"C:\test\tifSaveError")

shape = pyvips.Image.pdfload("shape.pdf", dpi=50)
size_design = shape.height * 2
shape_extend = shape.gravity("south", size_design, size_design, extend="white")
shape_extend.write_to_file("shape_extend.jpg")
shape_extend.write_to_file("shape_extend.png")
shape_extend.write_to_file("shape_extend.tif")

attached the pdf file used (3kb of size):
shape.pdf

image

the saved jpg and png file is correct, but the tif file is incomplete, only top half part.
image

@jcupitt
Copy link
Member

jcupitt commented May 29, 2019

Hi Jindili, it's saved it as a multi-page TIFF. I'll change this behaviour for 8.8.1 to make it less likely to happen by accident.

As a workaround, add:

shape.remove("page-height")

Just after the pdfload.

jcupitt added a commit that referenced this issue May 29, 2019
Some loaders were setting page-height even when the user was loading a
single page triggering unexpected multi-page behaviour from later
savers.

New rule: only set page-height when loading more than one page.

See #1318
@jcupitt
Copy link
Member

jcupitt commented May 29, 2019

OK, 8.8.1 will have nicer behaviour here and you won't need the remove() line. Thanks for reporting this!

@jcupitt jcupitt closed this as completed May 29, 2019
@jindili
Copy link
Author

jindili commented May 29, 2019

It works! Thanks John.

I use this line before version 8.8.1 is released.

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

No branches or pull requests

2 participants