allow ppm files as inputs
- only run bmp.magicValid when path ends in bmp - remove uneeced header size constants
This commit is contained in:
parent
91de05d3b1
commit
fb0516a1db
2 changed files with 3 additions and 5 deletions
|
@ -5,9 +5,6 @@ const bmp = @import("bmp_valid.zig");
|
|||
|
||||
const plugins = @import("plugin.zig");
|
||||
|
||||
/// Approximate size of the BMP header, in bytes.
|
||||
pub const BMPHeaderSize: usize = 82000;
|
||||
|
||||
/// Buffer size for main image copying.
|
||||
pub const BufferSize: usize = 300000;
|
||||
|
||||
|
@ -284,7 +281,8 @@ pub const Image = struct {
|
|||
var magic = [2]u8{ 0, 0 };
|
||||
_ = try file.read(&magic);
|
||||
|
||||
try bmp.magicValid(&magic);
|
||||
if (std.mem.endsWith(u8, self.path, ".bmp"))
|
||||
try bmp.magicValid(&magic);
|
||||
}
|
||||
|
||||
/// Run a plugin over the image.
|
||||
|
|
|
@ -89,7 +89,7 @@ pub const Runner = struct {
|
|||
// before loading the file into scritcher. for example, you can start
|
||||
// krita/gimp and make it export a bmp and while in the program you can
|
||||
// apply filters, etc.
|
||||
if (!std.mem.endsWith(u8, load_path, ".bmp")) {
|
||||
if (!std.mem.endsWith(u8, load_path, ".bmp") and !std.mem.endsWith(u8, load_path, ".ppm")) {
|
||||
std.debug.warn("Only BMP files are allowed to be loaded.\n");
|
||||
return RunError.NoBMP;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue