Browse Source

png-verify.pl: use Unit PixelsPerCentimeter

stable-4
Dietmar Maurer 3 years ago
parent
commit
9798ad65e7
2 changed files with 9 additions and 8 deletions
  1. 5
    4
      png-cleanup.pl
  2. 4
    4
      png-verify.pl

+ 5
- 4
png-cleanup.pl View File

@@ -12,11 +12,12 @@ my $outfile = shift ||
# use the following to verify image attributes
# identify -verbose <filename>

# set DPI to 146, so that we can display 1024 pixels (page width)
# set PixelsPerCentimeter to 58, so that we can display 1024
# pixels (page width)

my $dpi = 146;
my $dpcm = 58;

system("convert -units PixelsPerInch $infile -density $dpi $outfile");
system("convert -units PixelsPerCentimeter $infile -density $dpcm $outfile");

# identify should return the same value
# system("identify -units PixelsPerInch -format '%x x %y' $outfile");
# system("identify -units PixelsPerCentimeter -format '%x x %y' $outfile");

+ 4
- 4
png-verify.pl View File

@@ -6,11 +6,11 @@ use warnings;
my $infile = shift ||
die "no input file specified\n";

my $dpi = 146; # expected
my $dpcm = 58; # expected

my $tmp = `identify -units PixelsPerInch -format '%x x %y' $infile`;
my $tmp = `identify -units PixelsPerCentimeter -format '%x x %y' $infile`;

die "got unexpected DPI density '$tmp' (fix with png-cleanup.pl)\n"
if $tmp ne "$dpi x $dpi";
die "got unexpected density '$tmp' (fix with png-cleanup.pl)\n"
if $tmp ne "$dpcm x $dpcm";

exit 0;

Loading…
Cancel
Save