Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何设置图片的高度 #37

Closed
yijiaqingilm opened this issue Aug 20, 2020 · 5 comments
Closed

如何设置图片的高度 #37

yijiaqingilm opened this issue Aug 20, 2020 · 5 comments

Comments

@yijiaqingilm
Copy link

如何设置图片的高度?

@yijiaqingilm
Copy link
Author

v1版本的时候是支持传入图片宽度和高度参数,v2版本没有高度参数了,请问指定图片的高度?

@xd-tayde
Copy link
Owner

v1 版本也是无法设置的。图片的高度会根据原图比例进行自适应计算,可避免图片发生形变。请问是什么样的需求呢?

@yijiaqingilm
Copy link
Author

是这样的场景 ,我需要合成一张海报,上面是一张主图,下面会配置相应的文字,
但是主图的大小是不规则的,导致没法确定文字的位置。我的想法是固定一个 区域(指定宽高)将主图放入这个区域中 ,然后将主图填充到这个区域中。

@xd-tayde
Copy link
Owner

这个场景下,你应该提前加载获取下图片的尺寸,然后根据宽度等比计算下放入海报后的高度,就能准确知道文字应该在的位置了。如果固定宽高,可能会导致图片发生形变。

@yijiaqingilm
Copy link
Author

好的,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants