创建一个仅包含新尺寸的遮罩部分(没有透明区域)的新图像
我有一个蒙版和一个图像,在该图像上应用蒙版以获得该图像的一部分。 问题是当我在图像上应用该蒙版时,蒙版生成的图像与原始图像的大小相同。尽管未蒙版的部分是透明的。我需要的是一张只有原始图像的遮罩部分的图像,我不希望图像中出现透明部分。这样生成的图像将具有较小的尺寸并且仅包含被遮蔽的部分。
谢谢
I have a mask and an image on which mask is applied to get a portion of that image.
The problem is when I apply that mask on the image ,the resultant image from masking is of same size as the original image .Though the unmasked part is transparent. What I need is an image which only has the masked part of the original image ,I dont want transparent part to be in the image. so that the resultant image will be of smaller size an contain only the masked part.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以:
CGBitmapContextCreate
CGBitmapContext
提供外部缓冲区,使用以下各项的变体或组合:a) 像素偏移,b) 每行偏移字节,或 c) 手动移动位图数据(到位以减少内存)用法,如果可能的话)。CGBitmapContextCreate
CGImage
。CGBitmapContextCreateImage
You can:
CGBitmapContext
at actual size, providing a buffer for the bitmap.CGBitmapContextCreate
CGBitmapContext
providing the external buffer, using some variation or combination of: a) a pixel offset, b) offset bytes per row, or c) manually move the bitmap's data (in place to reduce memory usage, if possible).CGBitmapContextCreate
CGImage
from the second bitmap context.CGBitmapContextCreateImage