From 90849726e161d299cbb813caf98b9e08f3ac277a Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Tue, 4 Feb 2025 23:41:15 +0100 Subject: Removed jpeg as option but left jpg in --- .gitignore | 5 ++++- README.md | 1 + main.c | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 7594bd6..f8dd624 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .DS_Store -*.png blpconvert +samples/*.png +samples/*.bmp +samples/*.jpg +samples/*.tga diff --git a/README.md b/README.md index 62226ce..2321049 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Processing File: Folder: samples Filename: Ability_Ambush Extension: .blp + Format: png BLP File Details: Type: 1, BLP/DXTC/Uncompressed Compression: 2, DXTC diff --git a/main.c b/main.c index ab81be0..1b6369c 100644 --- a/main.c +++ b/main.c @@ -54,12 +54,12 @@ image_format get_format_type(const char *format) { if (strcasecmp(format, "png") == 0) return PNG; if (strcasecmp(format, "bmp") == 0) return BMP; if (strcasecmp(format, "tga") == 0) return TGA; - if (strcasecmp(format, "jpg") == 0 || strcasecmp(format, "jpeg") == 0) return JPG; + if (strcasecmp(format, "jpg") == 0) return JPG; return PNG; } bool is_valid_format(const char *format) { - const char *valid_formats[] = {"png", "bmp", "tga", "jpg", "jpeg", NULL}; + const char *valid_formats[] = {"png", "bmp", "tga", "jpg", NULL}; for (const char **f = valid_formats; *f != NULL; f++) { if (strcasecmp(format, *f) == 0) { return true; @@ -304,7 +304,7 @@ void decode_dxt_image(const uint8_t *image_data, uint32_t width, uint32_t height } break; case JPG: - if (verbose) printf("Processing as JPEG format\n"); + if (verbose) printf("Processing as JPG format\n"); if (stbi_write_jpg(output_filename, width, height, 4, decoded_image, 100) == 0) { printf("Failed to write %s file\n", output_filename); } else { @@ -425,7 +425,7 @@ void print_help(const char *program_name) { printf(" -h, --help Display this help message\n"); printf(" -v, --verbose Enable verbose output\n"); printf(" -f, --format=FORMAT Set output format (default: png)\n"); - printf(" Options: png, bmp, tga, jpg, jpeg\n"); + printf(" Options: png, bmp, tga, jpg\n"); } int main(int argc, char *argv[]) { @@ -455,7 +455,7 @@ int main(int argc, char *argv[]) { break; case 'f': if (!is_valid_format(optarg)) { - fprintf(stderr, "Error: Invalid format '%s'. Valid formats are: png, bmp, tga, jpg, jpeg\n", optarg); + fprintf(stderr, "Error: Invalid format '%s'. Valid formats are: png, bmp, tga, jpg\n", optarg); return 1; } format = optarg; -- cgit v1.2.3