2
0
mirror of https://github.com/koreader/koreader synced 2024-11-18 03:25:46 +00:00
koreader/frontend/ui/image.lua

26 lines
471 B
Lua
Raw Normal View History

Image = {}
function Image._getFileData(filename)
2012-04-15 00:26:24 +00:00
local f = io.open(filename)
local data = f:read("*a")
f:close()
return data
end
function Image.fromPNG(filename)
local img = mupdfimg.new()
img:loadPNGData(Image._getFileData(filename))
local bb = img:toBlitBuffer()
img:free()
return bb
end
function Image.fromJPEG(filename)
local img = mupdfimg.new()
2012-04-15 21:39:53 +00:00
img:loadJPEGData(Image._getFileData(filename))
local bb = img:toBlitBuffer()
img:free()
return bb
end