File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+ # Author: Trizen
4
+ # Date: 10 August 2025
5
+ # https://github.com/trizen
6
+
7
+ # Hard-rotate images that contain the "Orientation" EXIF tag specified as "Rotate 90 CW" or "Rotate 270 CW".
8
+
9
+ use 5.036;
10
+ use Imager;
11
+ use Image::ExifTool qw( ImageInfo) ;
12
+
13
+ foreach my $file (@ARGV ) {
14
+
15
+ say " :: Processing: $file " ;
16
+
17
+ my $info = ImageInfo($file );
18
+ my $orientation = $info -> {Orientation };
19
+
20
+ if (defined ($orientation ) and $orientation =~ / ^Rotate (\d +) CW/ ) {
21
+
22
+ my $angle = $1 ;
23
+ say " -> Rotating image by $angle degrees clockwise..." ;
24
+
25
+ my $img = Imager-> new(file => $file ) or die Imager-> errstr();
26
+ $img = $img -> rotate(degrees => $angle );
27
+ unlink ($file );
28
+ $img -> write (file => $file ) or die $img -> errstr;
29
+ }
30
+ }
Original file line number Diff line number Diff line change @@ -539,6 +539,7 @@ A nice collection of day-to-day Perl scripts.
539
539
* [ Gd star trails] ( ./Image/gd_star_trails.pl )
540
540
* [ Gif2webp] ( ./Image/gif2webp.pl )
541
541
* [ Horizontal scrambler] ( ./Image/horizontal_scrambler.pl )
542
+ * [ Image-hard-rotate] ( ./Image/image-hard-rotate.pl )
542
543
* [ Image-unpack] ( ./Image/image-unpack.pl )
543
544
* [ Image2ascii] ( ./Image/image2ascii.pl )
544
545
* [ Image2audio] ( ./Image/image2audio.pl )
You can’t perform that action at this time.
0 commit comments