Cropping images sometimes a wrong area

后端 未结 1 1458
情歌与酒
情歌与酒 2020-12-21 22:39

I\'m using jQuery-cropbox to crop images on a web application.

Everything is running smoothly most of the time, but from time to time, the generated image is wrong,

1条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-21 23:26

    Your image (as posted) has 72dpi; your screen and therefore the Graphics you use probably have 96dpi.

    This will lead to the effect you see.

    To avoid the effect simply set the resolution of img before drawing it to the one in your Graphics object:

    img.SetResolution((int)g.DpiX, (int)g.DpiY);
    

    0 讨论(0)
提交回复
热议问题