Revision 348

Date:
2013/05/21 21:09:53
Author:
ahitrov
Revision Log:
Much more accurate resizing algorythms
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/lib/Contenido/File.pm

     
    243 243 if ( exists $prop->{transform} && ref $prop->{transform} eq 'ARRAY' && scalar @{$prop->{transform}} == 2 && $prop->{transform}[0] =~ /(crop|resize|shrink)/ ) {
    244 244 my $c_line;
    245 245 if ( $prop->{transform}[0] eq 'resize' ) {
    246 $c_line = $state->{'convert_binary'}.' -resize \''.$prop->{transform}[1].'\' -quality 80 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    246 $c_line = $state->{'convert_binary'}.' -adaptive-resize \''.$prop->{transform}[1].'>\' -quality 100 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    247 247 } elsif ( $prop->{transform}[0] eq 'crop' ) {
    248 248 my $shave_string;
    249 249 my ($nwidth, $nheight) = $prop->{transform}[1] =~ /(\d+)x(\d+)/i ? ($1, $2) : (0, 0);
     
    269 269 return undef;
    270 270 }
    271 271 }
    272 $c_line = $state->{'convert_binary'}.' -geometry \''.$prop->{transform}[1].'!\' -quality 80 '.$filename_tmp.'.shaved.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    272 $c_line = $state->{'convert_binary'}.' -adaptive_resize \''.$prop->{transform}[1].'!\' -quality 100 '.$filename_tmp.'.shaved.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    273 273 } elsif ( $prop->{transform}[0] eq 'shrink' ) {
    274 $c_line = $state->{'convert_binary'}.' -geometry \''.$prop->{transform}[1].'!\' -quality 80 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    274 $c_line = $state->{'convert_binary'}.' -adaptive_resize \''.$prop->{transform}[1].'!\' -quality 100 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.transformed.'.$ext;
    275 275 }
    276 276 my $result = `$c_line`;
    277 277 $transformed = 1;
     
    298 298 }
    299 299
    300 300 foreach my $suffix (@preview) {
    301 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'\' -quality 80 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    301 my $c_line = $state->{'convert_binary'}.' -resize \''.$suffix.'>\' -quality 90 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    302 302 my $result = `$c_line`;
    303 303
    304 304 if (length $result > 0) {
     
    344 344 }
    345 345 }
    346 346
    347 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 80 '.$filename_tmp.'.shaved.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    347 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 90 '.$filename_tmp.'.shaved.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    348 348 my $result = `$c_line`;
    349 349
    350 350 if (length $result > 0) {
     
    371 371 ########## SHRINKS
    372 372 foreach my $suffix (@shrinks) {
    373 373
    374 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 80 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    374 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 90 '.$filename_tmp.'.'.$ext.' '.$filename_tmp.'.'.$suffix.'.'.$ext;
    375 375 my $result = `$c_line`;
    376 376
    377 377 if (length $result > 0) {