#struggling to calculate the rowstride (the last argument)

6 messages · Page 1 of 1 (latest)

modern cliff
#
 GdkPixbuf* pixbuf = gdk_pixbuf_new_from_bytes(bytes, GDK_COLORSPACE_RGB, false, 8, post->previewWidth, post->previewHeight, post->previewWidth*3);

this fails with: gdk_pixbuf_new_from_bytes: assertion 'g_bytes_get_size (data) >= width * height * (has_alpha ? 4 : 3)' failed

for example, when width is 50, the height is 50, the rowstride is 150, right? Because the formula is width*BPP, which is 3 in case of RGB and 4 in case of RGBA. This works. But when i try to set - for example - 800 and 500, with a rowstride of 2400, it fails with this error.

Even when I switched to calculating the rowstride directly from the image's width, I can't get it to work

edgy abyssBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

modern cliff
#

funny enough
even their function can't calculate it

gint rowstride = gdk_pixbuf_calculate_rowstride(GDK_COLORSPACE_RGB, false, 8, post->previewWidth, post->previewHeight);
modern cliff
#

Fixed. Had to use GInputStream instead