微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

裁剪图像大图像的大小 >200 kb在 VBA 中不正确

如何解决裁剪图像大图像的大小 >200 kb在 VBA 中不正确

我为这个问题搜索了很多次,但没有得到正确的答案。我想按照我想要的条件裁剪图像的 x、y、右、底部(我在绘图软件中打开它并获得我想要的 x、y、宽度、高度。)我按照 x、y、右裁剪它,底部然后它正确裁剪但是当我裁剪大图像(大小图像> 200 kb)时遇到问题。它裁剪不正确。我不知道为什么它会出错。 任何人都可以帮我解决它。太感谢了 ! 这是我的代码

Dim sh as shape
Dim shpCrop As Shape
Dim sngMemoLeft As Double
Dim sngMemoTop As Double
Dim crLeft As Double
Dim crTop As Double
Dim crBottom As Double
Dim crRight As Double

Set sh = ActiveSheet.Shapes.AddPicture _
        fileName:=strPathFileImg,_
        linktofile:=msoFalse,savewithdocument:=msoCTrue,_
        left:=65,top:=50,width:=1300,height:=755

crLeft = (x_Crop ) * 0.75
crTop = (y_Crop ) * 0.75
crBottom = (bottom_Crop ) * 0.75
crRight = (right_Crop ) * 0.75

'Trim img
Set shpCrop = ActiveSheet.Shapes(sh.name)
With shpCrop
    sngMemoLeft = .left
    sngMemoTop = .top
    With .PictureFormat
        .CropLeft = crLeft
        .CropTop = crTop
        .CropBottom = crBottom
        .CropRight = crRight
    End With
    .left = sngMemoLeft
    .top = sngMemoTop
End With

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。