mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
PicDocument:getCoverPageImage(): use first page instead of MuPDF
The dedicated image format library may often give better results than MuPDF (eg: for animated GIFs).
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user