Jpg data array to texture

Hello

I have a jpg array and want to convert it to a texture or an image

I tried converting the array to ofPixels object and later setting those ofPixels to a ofImage but dont work, i assume that is because the jpg data array is compressed and for example the size do not match the withheight3 size.

I mean the image is 640480 rgb so must be 640480*3 but as is a jpg array size is less, i think i can decompress the jpg… but maybe there is another way

Thanks

Hey just thinking out loud, but have you tried getting the array into an ofBuffer and then using ofImage::load() with the ofBuffer? There is a version of ofImage::load() that will take an ofBuffer object along with some other arguments.

@pandereto I assume that you want to load multiple JPG images as textures or pixels.
There is a function ofLoadImage which you can load image data on a disk as any format (ofTexture, ofImage, ofPixels) so you may want to check it.
https://openframeworks.cc/documentation/graphics/ofImage/#show_ofLoadImage

Thanks to all i ended using libjpeg turbo to save some ms