PicDocument:getCoverPageImage(): use first page instead of MuPDF

The dedicated image format library may often give better results
than MuPDF (eg: for animated GIFs).
pull/3908/head
poire-z 6 years ago
parent 782a57121c
commit 7a2bf21434

@ -41,15 +41,9 @@ function PicDocument:getProps()
end
function PicDocument:getCoverPageImage()
local f = io.open(self.file, "rb")
if f then
local data = f:read("*all")
f:close()
local Mupdf = require("ffi/mupdf")
local ok, image = pcall(Mupdf.renderImage, data, data:len())
if ok then
return image
end
local first_page = self._document:openPage(1)
if first_page.image_bb then
return first_page.image_bb
end
return nil
end

Loading…
Cancel
Save