Add conversion from any input file via ImageMagick
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include <netpbm/pam.h>
|
||||
#include "pixels.hpp"
|
||||
|
||||
static void write(std::ostream& os, FILE* in) {
|
||||
void write_image(std::ostream& os, FILE* in) {
|
||||
struct pam info;
|
||||
pnm_readpaminit(in, &info, PAM_STRUCT_SIZE(tuple_type));
|
||||
std::unique_ptr<tuple, void(*)(void*)> row1 {pnm_allocpamrow(&info), pm_freerow};
|
||||
@@ -32,10 +32,10 @@ static void write(std::ostream& os, FILE* in) {
|
||||
}
|
||||
|
||||
void write_image(std::ostream& os) {
|
||||
write(os, stdin);
|
||||
write_image(os, stdin);
|
||||
}
|
||||
|
||||
void write_image(std::ostream& os, const std::string& path) {
|
||||
std::unique_ptr<FILE, void(*)(FILE*)> infile {pm_openr(path.c_str()), pm_close};
|
||||
write(os, infile.get());
|
||||
write_image(os, infile.get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user