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

如何计算图片的内存大小 #43

Open
shichuanyang opened this issue Jan 27, 2022 · 2 comments
Open

如何计算图片的内存大小 #43

shichuanyang opened this issue Jan 27, 2022 · 2 comments

Comments

@shichuanyang
Copy link

想请教下这个问题,
我先在用的是 CGImageGetHeight(image.CGImage) * CGImageGetBytesPerRow(image.CGImage); 好像不正确

@Rogue24
Copy link
Owner

Rogue24 commented Jan 27, 2022

@shichuanyang 图片的内存大小的计算是:图片的像素宽 * 图片的像素高 * 每个像素所占的字节数
totalByte = pw * ph * 4 一个像素占4个字节(ARPG)

@shichuanyang
Copy link
Author

朋友 为何 pw * ph * 4 得出的结果 和把这行图片保存到相中的结果不一样呢

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