Created
July 1, 2015 07:07
-
-
Save Songmu/06d4370a1d5c68e3691b to your computer and use it in GitHub Desktop.
DPI直すやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use 5.014; | |
| use warnings; | |
| my $file = $ARGV[0]; | |
| system qw/sips -d profile --deleteColorManagementProperties/, $file; | |
| my $dpiWidth = `sips -g dpiWidth $file | awk '/:/ {print \$2}'`; | |
| my $dpiHeight = `sips -g dpiHeight $file | awk '/:/ {print \$2}'`; | |
| my $pixelWidth = `sips -g pixelWidth $file | awk '/:/ {print \$2}'`; | |
| my $pixelHeight = `sips -g pixelHeight $file | awk '/:/ {print \$2}'`; | |
| if ($dpiWidth > 72.0 && $dpiHeight > 72.0) { | |
| my $width = $pixelWidth * 72.0 / $dpiWidth; | |
| my $height = $pixelHeight * 72.0 / $dpiHeight; | |
| system qw/sips -s dpiWidth 72 -s dpiHeight 72 -z/, $height, $width, $file; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment