Skip to content

Commit

Permalink
Fix interaction between gzip mode and png/jpeg files
Browse files Browse the repository at this point in the history
Addresses an issue when -gzip is specified:
- When compressing PNG/JPG files with -gzip, ECT will now actually create
  a gzip archive. Previously it would just optimize the file, even if
  the --disable-(png|jpg) flags were enabled.

Fixes #133.
  • Loading branch information
fhanau committed Oct 23, 2023
1 parent a53124b commit 380a1df
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,15 @@ unsigned fileHandler(const char * Infile, const ECTOptions& Options, int interna
}
int statcompressedfile = 0;
if (size < 1200000000) {//completely random value
if (x == "PNG" || x == "png"){
error = OptimizePNG(Infile, Options);
}
else if (x == "jpg" || x == "JPG" || x == "JPEG" || x == "jpeg"){
error = OptimizeJPEG(Infile, Options);
}
else if (Options.Gzip && !internal){
if (Options.Gzip && !internal) {
statcompressedfile = ECTGzip(Infile, Options.Mode, Options.DeflateMultithreading, size, Options.Zip, Options.Strict);
if (statcompressedfile == 2){
return 1;
}
} else if (x == "PNG" || x == "png") {
error = OptimizePNG(Infile, Options);
} else if (x == "jpg" || x == "JPG" || x == "JPEG" || x == "jpeg") {
error = OptimizeJPEG(Infile, Options);
}
if(Options.SavingsCounter && !internal){
processedfiles.fetch_add(1);
Expand Down

0 comments on commit 380a1df

Please sign in to comment.