ViperDriver35
New Member
- Joined
- Mar 18, 2018
- Messages
- 7
Hello, I am attempting to use VBA to crop images to a 1:1 aspect ratio. Here is the code that I am using currently:
With shp
Width = .Width
Height = .Height
TCrop = Width - Height
Hcrop = TCrop / 2
End With
With .PictureFormat
.CropLeft = Hcrop
.CropTop = 0
.CropBottom = 0
.CropRight = Hcrop
End With
It is not working and more confusingly, it is not delivering consistent results among images with different initial aspect ratios (i.e. 16:9 and 4:3 do not end up with the same aspect ratio after the macro is run). Any help would be greatly appreciated. I have run out of troubleshooting ideas. Thanks!
With shp
Width = .Width
Height = .Height
TCrop = Width - Height
Hcrop = TCrop / 2
End With
With .PictureFormat
.CropLeft = Hcrop
.CropTop = 0
.CropBottom = 0
.CropRight = Hcrop
End With
It is not working and more confusingly, it is not delivering consistent results among images with different initial aspect ratios (i.e. 16:9 and 4:3 do not end up with the same aspect ratio after the macro is run). Any help would be greatly appreciated. I have run out of troubleshooting ideas. Thanks!