Add error message for image loading error #133
This commit is contained in:
parent
1cf9307ffb
commit
0e93848984
|
@ -39,6 +39,9 @@ end
|
|||
|
||||
local function convert_image(opt)
|
||||
local x, meta = image_loader.load_float(opt.i)
|
||||
if not x then
|
||||
error(string.format("failed to load image: %s", opt.i))
|
||||
end
|
||||
local alpha = meta.alpha
|
||||
local new_x = nil
|
||||
local scale_f, image_f
|
||||
|
@ -188,10 +191,14 @@ local function convert_frames(opt)
|
|||
table.insert(lines, line)
|
||||
end
|
||||
fp:close()
|
||||
|
||||
for i = 1, #lines do
|
||||
local output = format_output(opt, lines[i], i)
|
||||
if opt.resume == 0 or path.exists(output) == false then
|
||||
local x, meta = image_loader.load_float(lines[i])
|
||||
if not x then
|
||||
io.stderr:write(string.format("failed to load image: %s\n", lines[i]))
|
||||
else
|
||||
local alpha = meta.alpha
|
||||
local new_x = nil
|
||||
if opt.m == "noise" then
|
||||
|
@ -223,6 +230,7 @@ local function convert_frames(opt)
|
|||
end
|
||||
image_loader.save_png(output, new_x,
|
||||
tablex.update({depth = opt.depth, inplace = true}, meta))
|
||||
end
|
||||
if not opt.q then
|
||||
xlua.progress(i, #lines)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue