Skip to content

Commit 97597da

Browse files
authored
fix(oiiotool): make sure oiiotool --compression does expression substitution (#5055)
`oiiotool --compression XXX` just used the argument as a literal, and wasn't able to use expression substitution for the value. That made it behave differently than the supposedly synonymous `--attrib compression XXX` in the case that the argument was an expression rather than a literal value. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 3cefa62 commit 97597da

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/oiiotool/oiiotool.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,15 @@ set_dataformat(Oiiotool& ot, cspan<const char*> argv)
11631163

11641164

11651165

1166+
// --compression
1167+
static void
1168+
set_compression(Oiiotool& ot, cspan<const char*> argv)
1169+
{
1170+
ot.output_compression = ot.express(argv[1]);
1171+
}
1172+
1173+
1174+
11661175
// --if
11671176
static void
11681177
control_if(Oiiotool& ot, cspan<const char*> argv)
@@ -6758,8 +6767,9 @@ Oiiotool::getargs(int argc, char* argv[])
67586767
.OTACTION(output_tiles);
67596768
ap.arg("--force-tiles", &ot.output_force_tiles)
67606769
.hidden(); // undocumented
6761-
ap.arg("--compression %s:NAME", &ot.output_compression)
6762-
.help("Set the compression method (in the form \"name\" or \"name:quality\")");
6770+
ap.arg("--compression %s:NAME")
6771+
.help("Set the compression method (in the form \"name\" or \"name:quality\")")
6772+
.OTACTION(set_compression);
67636773
ap.arg("--quality %d:QUALITY", &ot.output_quality)
67646774
.hidden(); // DEPRECATED(2.1)
67656775
ap.arg("--dither", &ot.output_dither)

0 commit comments

Comments
 (0)