Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preserve metadata flag #175

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions guetzli/guetzli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,13 @@ void Usage() {
"guetzli [flags] input_filename output_filename\n"
"\n"
"Flags:\n"
" --verbose - Print a verbose trace of all attempts to standard output.\n"
" --quality Q - Visual quality to aim for, expressed as a JPEG quality value.\n"
" Default value is %d.\n"
" --memlimit M - Memory limit in MB. Guetzli will fail if unable to stay under\n"
" the limit. Default limit is %d MB.\n"
" --nomemlimit - Do not limit memory usage.\n", kDefaultJPEGQuality, kDefaultMemlimitMB);
" --verbose - Print a verbose trace of all attempts to standard output.\n"
" --quality Q - Visual quality to aim for, expressed as a JPEG quality value.\n"
" Default value is %d.\n"
" --memlimit M - Memory limit in MB. Guetzli will fail if unable to stay under\n"
" the limit. Default limit is %d MB.\n"
" --nomemlimit - Do not limit memory usage.\n"
" --preserve-exif - Preserve exif data.\n", kDefaultJPEGQuality, kDefaultMemlimitMB);
exit(1);
}

Expand All @@ -232,6 +233,8 @@ void Usage() {
int main(int argc, char** argv) {
std::set_terminate(TerminateHandler);

guetzli::Params params;

int verbose = 0;
int quality = kDefaultJPEGQuality;
int memlimit_mb = kDefaultMemlimitMB;
Expand All @@ -254,6 +257,8 @@ int main(int argc, char** argv) {
memlimit_mb = atoi(argv[opt_idx]);
} else if (!strcmp(argv[opt_idx], "--nomemlimit")) {
memlimit_mb = -1;
} else if (!strcmp(argv[opt_idx], "--preserve-exif")) {
params.clear_metadata = false;
} else if (!strcmp(argv[opt_idx], "--")) {
opt_idx++;
break;
Expand All @@ -270,7 +275,6 @@ int main(int argc, char** argv) {
std::string in_data = ReadFileOrDie(argv[opt_idx]);
std::string out_data;

guetzli::Params params;
params.butteraugli_target = static_cast<float>(
guetzli::ButteraugliScoreForQuality(quality));

Expand Down