Never used the framework but my first thought would be to create a CGImageRef which can take directly formatted data (I'm assuming that vImages are just a byte buffer) and then make a UIImage from there.

What did you do to get a vImage from your UIImage in the first place?

On May 12, 2012, at 8:26 PM, Luca Ciciriello wrote:

> Now my problem is:
> How can I rebuild an UIImage from the output of the vImageConvolve_ARGB8888 elaboration?
> I can't find any code sample on this.
>
> L.
> On May 12, 2012, at 11:16 AM, Luca Ciciriello wrote:
> >> Yes You are right. It was a my stupid syntax error.
>>
>> L.
>>
>> On May 12, 2012, at 10:34 AM, Ken Thomases wrote:
>> >>> On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote:
>>> >>>> Using the accelerate framework in iOS 5.1 I've imported the header Accelerate/Accelerate.h and in my code I'm using the line:
>>>>
>>>> uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0};
>>>>
>>>> My problem is that I've got the error:
>>>>
>>>> "Use of undeclared identifier uint_8".
>>>>
>>>> Which is the header I've to use for uint_8?>>>
>>> Do you perhaps mean uint8_t? Certainly, the Accelerate framework won't require you to use any type which it hasn't included the definition for.
>>>
>>> Regards,
>>> Ken
>>>
>>>
>>

.. got moderated for size .. so I'll send again .. I think perhaps the formatted code in your mail was on the ragged edge for the list ... Scott feel free to axe the original version of this message if you see it when doing the moderation queue ...

---- original message ------`

I'm guessing from my quick read of a few pages of the documentation whilst watching formula1 but I don't think you can do that. You went through a CGImageRef, I would expect you have to go back through it. I don't think UIImage will take what looks like a pretty raw buffer, it's only for a limited set of formats. I, were I trying this, would be looking at CGImageCreate with a CGDataProviderRef which just rips right out of your data buffer and then make a UIImage with that.

This is me guessing but it's what I'd try if I were doing this. I don't know if there is a better way to get the initial bytes by the way, there may be, slow drawing into a bitmap context but quite possibly right. Will be interested to see other replies here.

Grr .. again with the moderation for size .. can you not use rich text or something, it just makes a 6k message into a 50k one and this list has a really small max message size. Sending the mail yet again ..

---- original mail follows with the rich text turned into plain ------

I said CGImageCreate, I think that's what you want, you certainly don't have a PNG, you have a bitmap of data, a raw buffer. I think you probably have the right data provider, that or use CGCreateDataProviderDirect() which looks the same for raw data but works directly with the buffer, but just plain CGImageCreate() looks like the function which takes raw bytes in an expressed format and makes the image. Definitely the PNGDataProvider is wrong, you don't have one of those.

>
> On May12, 2012, at 9:27 PM, Luca Ciciriello wrote:
>
> Now I've used the code: where
>
> CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, outData, (768 * 768 * 4), NULL);
> CGImageRef test = CGImageCreateWithPNGDataProvider(provider, nil, true, kCGRenderingIntentDefault);
>
> where outData is the output of my EmbossEffect function.
>
> Here "provider" is valorized, but "test" is 0x0.
> My suspect is that vImageConvolve_ARGB8888 is working with bitmap and a CGImageCreateWithPNGDataProvider is working with PNG, but I haven't found an equivalent function for Bitmap.
>
> Luca.
>
>