Conversation
7d55ffb to
4269c70
Compare
|
FYI this (and the other vertical flip PR) need more work to be merged: the flag should be rejected in progressive mode, updates to documentation and at least one unit test (annoying I know). |
4269c70 to
a6d5e4a
Compare
|
Now it is possible to flip the image, if yes, how? And then when saving an OGL-screenshot you have to flip the image manually: |
|
@DaniilPetrov without this feature you can still flip it using progressive encode by starting with the last row and going backwards |
|
Yes, that is true, but it will be slow and is more lines of code than the modification I did on your code. Besides, I can see that other people are possibly using OpenGL and would benefit from this, so from my point of view that seems like an interesting feature to have. Sorry I have little time |
|
I agree it is a useful feature but right now I'm working on APNG support, I'll try to include this some time after. |
|
That is reasonable. I will try to find time to document the feature later this summer. Thank you very much for libspng! |
How to do this? |
You have to add the spng_encode_image(ctx, NULL, 0, fmt, SPNG_ENCODE_PROGRESSIVE | SPNG_ENCODE_FINALIZE);
size_t image_width = image_size / Screenshot.screenHeight;
size_t image_offset = image_size;
do
{
image_offset -= image_width;
ret = spng_encode_row(ctx, image + image_offset, image_width);
}while(!ret)
if(ret != SPNG_EOI) /* error */Note this code assumes you're not setting |
This is adding an option to flip the image vertically upon encoding.
I do not understand the structure of the code, but the modifications are local to spng_encode_image(), and they work for me. All the best!