File:Leucospermum cultivar gradual decrease of quality.jpg
| Uploaded by | AzaToth |
|---|---|
| Upload date | 2011-09-16T18:03:58Z |
| MIME type | image/jpeg |
| Dimensions | 1805 × 1200 px |
| File size | 876.2 KB |
Summary
| Description |
English: Visualization of decreasing JPEG quality, with lowest quality in the middle, and highest at the left and right. |
| Date | |
| Source |
Own work based on: Leucospermum cultivar.jpg: |
| Author | AzaToth |
Following code was used to modify the original image:
#!/usr/bin/perl
use strict;
use warnings;
use v5.12;
use File::Temp qw/ tempdir /;
use Graphics::Magick;
use Math::Round qw(:all);
my $p = new Graphics::Magick;
$p->Read("Leucospermum_cultivar.jpg");
my ($width, $height) = $p->Get('width', 'height');
my $center = $width/2;
my $result = new Graphics::Magick;
$result->Set(size=>"${width}x${height}");
$result->Read();
$result->Set('quality', 100);
my $dir = tempdir(CLEANUP => 1);
my $chop = 16; # 1 MCU normally
for my $col (0..$width) {
next if $col%$chop;
my $current = $p->Clone();
$current->Crop(width => $chop, height => $height, x => $col, y => 0);
$current->Set('quality' => round_even(100*abs(($col-$center)/$center)));
my $filename = sprintf "%s/%05d.jpg", $dir, $col;
$current->Write($filename);
my $n = new Graphics::Magick;
$n->Read($filename);
$result->Composite( image => $n, x => $col, y => 0);
}
$result->Write('Leucospermum_cultivar_gradual_decrease_of_quality.jpg');
Licensing
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.