-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added option to flip image on encode #211
base: master
Are you sure you want to change the base?
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!