diff --git a/src/image.zig b/src/image.zig index 9748bc9..c9a436c 100644 --- a/src/image.zig +++ b/src/image.zig @@ -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. diff --git a/src/runner.zig b/src/runner.zig index 800fd69..8169393 100644 --- a/src/runner.zig +++ b/src/runner.zig @@ -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; }