Skip to content
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

Add option to invert rows in spng_encode_image #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tobybell
Copy link

@tobybell tobybell commented Sep 9, 2024

This merge request is to share back something I implemented in a downstream copy of the project. No pressure to accept it; just sharing in case it's useful.

Previously, spng_encode_image would always interpret the img data pointer as pointing to image data in top-to-bottom order, despite some image data APIs storing image data in bottom-to-top order (most notably, OpenGL functions like glReadPixels).

This merge request adds a flag, SPNG_ENCODE_INVERT_ROWS to allow spng_encode_image to interpret the given image data pointer as containing rows in bottom-to-top order, instead of top-to-bottom. This allows saving PNG images directly from glReadPixels calls when using OpenGL, without an additional copy to reverse the row data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant