ffmpegthumbnailer icon indicating copy to clipboard operation
ffmpegthumbnailer copied to clipboard

RGBA raw writer

Open GoogleCodeExporter opened this issue 10 years ago • 7 comments

Sometimes, I want to know rgb value from the file. 
My attachment is related to RawWriter which can store RGBA image.


Original issue reported on code.google.com by [email protected] on 15 Feb 2013 at 12:10

Attachments:

GoogleCodeExporter avatar Mar 15 '15 09:03 GoogleCodeExporter

Shouldn't the inner loop look like this

rgba |= 0xff << 24;
rgba |= *(*(rgbData + i) + j + 2) << 16;
rgba |= *(*(rgbData + i) + j + 1) << 8;
rgba |= *(*(rgbData + i) + j);

Otherwise the R and B channels are swapped when I try to analyse the result 
using the Python Image Library

Original comment by dirk.vdb on 16 Feb 2013 at 10:46

GoogleCodeExporter avatar Mar 15 '15 09:03 GoogleCodeExporter

You're right. RGBA should be arranged like your comment. 
but, in case of my code, I'm using "BGRA" type of raw image.
I think it should be clear by an option.





Original comment by [email protected] on 18 Feb 2013 at 2:04

GoogleCodeExporter avatar Mar 15 '15 09:03 GoogleCodeExporter

I was just trying to use FFmpegthumbnailer in https://github.com/BestImageViewer/geeqie and it would be very helpful to see this feature. Especially using library, it is often counterproductive to create a PNG file just to decode it again to raw data (like e.g. in https://github.com/xfce-mirror/tumbler/blob/master/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c)

tomaszg7 avatar Nov 11 '17 23:11 tomaszg7

You can now specify Rgb as image type, the buffer will then create the raw rgb data. Unfortunately, with the current API the buffer will be allocated by the library so you would still have to potentially copy it depending on your use case.

dirkvdb avatar Nov 13 '17 11:11 dirkvdb

Great. Thank you. However I'm a bit unclear - C api doesn't tell me the exact height/width of a generated thumbnail, only size. In this way it is not possible to interpret the data in the buffer in a meaningful way. Am I missing something?

tomaszg7 avatar Nov 13 '17 11:11 tomaszg7

You are right, the width height information was missing. I committed a change that adds with and height information to the image_data_struct.

dirkvdb avatar Nov 13 '17 15:11 dirkvdb

Now it works flawlessly with gdk_pixbuf_new_from_data. Thanks.

tomaszg7 avatar Nov 13 '17 16:11 tomaszg7