From c69fc4e88af0bfe12c9b4f589309a6e12e5fefc9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 28 Aug 2013 21:51:51 +0200 Subject: specify negative no_lines to autocrop png (remove black space) --- lib/App/VRR/Fakedisplay.pm.PL | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/App') diff --git a/lib/App/VRR/Fakedisplay.pm.PL b/lib/App/VRR/Fakedisplay.pm.PL index d051f2c..7969bde 100644 --- a/lib/App/VRR/Fakedisplay.pm.PL +++ b/lib/App/VRR/Fakedisplay.pm.PL @@ -169,6 +169,23 @@ sub new_line { return; } +sub crop_to_content { + my ($self) = @_; + + my $new_im = GD::Image->new($self->{width} * $self->{scale}, + $self->{offset_y} * $self->{scale}, 1); + $new_im->copyResized($self->{image}, 0, 0, 0, 0, + $self->{width} * $self->{scale}, + $self->{offset_y} * $self->{scale}, + $self->{width} * $self->{scale}, + $self->{offset_y} * $self->{scale} + ); + + $self->{image} = $new_im; + + return; +} + sub png { my ($self) = @_; -- cgit v1.2.3