Subject: | PNG output options not supported |
The current code results in an error if one uses png output options as part of the output type. The module fixates the options to 'png small' and barks if one specifies 'png other-options'. This can be easily solved with the patch attached below.
HTH/Frank
--- Gnuplot.pm.orig 2017-05-17 12:56:31.529061016 +0200
+++ Gnuplot.pm 2017-05-17 12:56:44.060019303 +0200
@@ -357,15 +357,15 @@
$output_file = $value;
}
- if ($key eq "output type") {
- if (!($value =~ /^(pbm|gif|tgif|png|svg|eps(:? .*)?)$/)) {
- carp "invalid output type: $value";
- $handle->close();
- _cleanup_tmpdir();
- return 0;
- }
- $output_type = $value;
- }
+ if ($key eq "output type") {
+ if (!($value =~ /^(pbm|gif|tgif|png( .*)?|svg|eps(:? .*)?)$/)) {
+ carp "invalid output type: $value - ".($1//'x');
+ $handle->close();
+ _cleanup_tmpdir();
+ return 0;
+ }
+ $output_type = $value;
+ }
}
# create the data file
@@ -388,12 +388,14 @@
$plot_file = _make_tmpfile("plot", "pbm");
print $handle "set output \"$plot_file\"\n";
print $handle "set terminal pbm small color\n";
- } elsif ($output_type eq "png") {
- if (defined $output_file) {
- $plot_file = _make_tmpfile("plot", "png");
- print $handle "set output \"$plot_file\"\n";
- }
- print $handle "set terminal png small\n";
+ } elsif ($output_type =~ /^png(.*)?$/) {
+ my $options = $1 || 'small';
+ $output_type = 'png';
+ if (defined $output_file) {
+ $plot_file = _make_tmpfile("plot", "png");
+ print $handle "set output \"$plot_file\"\n";
+ }
+ print $handle "set terminal png $options\n";
} elsif ($output_type eq "tgif") {
if (defined $output_file) {
$plot_file = _make_tmpfile("plot", "obj");