Skip to content

VipsOperation: class "new_from_memory" not found #15

@stuta

Description

@stuta

I'm using twain to read raw data from scanner but vips.Image.new_from_memory() prints:
error: 'no such operation
VipsOperation: class "new_from_memory" not found
'

local depth = twain.TWAIN_DibDepth(hdib) --  Depth of DIB, in bits i.e. bits per pixel.
local width = twain.TWAIN_DibWidth(hdib) -- Width of DIB, in pixels (columns)
local height = twain.TWAIN_DibHeight(hdib) -- Height of DIB, in lines (rows)
local rowBytes = twain.DIB_RowBytes(hdib) -- Number of bytes needed to store one row of the DIB.
local size = height * rowBytes
local data = ffi.new("unsigned char[?]", size) -- unsigned char[?]== BYTE[?]
local dst
for nRow = 0, height - 1 do
 dst = data + (nRow * rowBytes)
 twain.DIB_ReadRow(hdib, nRow, dst) -- Read row n of the given DIB into buffer at dst
end
local image = vips.Image.new_from_memory(data, size, width, height, depth, C.VIPS_FORMAT_UCHAR) -- C.VIPS_FORMAT_UCHAR == 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions