iphone - Retrieving RGBA values from an image -
this question has answer here:
i retrieving data image using cgdataprovidercopydata bytes returned function large when compared image file size. here code.
uiimage *image = self.imageview.image; cgimageref cgimage = image.cgimage; cgdataproviderref provider = cgimagegetdataprovider(cgimage); nsdata* data = (__bridge_transfer nsdata*)cgdataprovidercopydata(provider);
is there other approach read pixel data , obtain rgba values image.
what doing correct. image file on disk in compressed format. when load data uiimage
, image uncompressed , takes "width x height x 4" bytes. "4" assumes rgba. , data can bit bigger since bytes per row multiple of 16 bytes.
one thing loading bytes image. don't assume rgba. depending on image, in other formats. use proper functions determine color model, bytes per pixel , bytes per row.
Comments
Post a Comment