glReadPixels and save to image
Posted
by
Julius Petraška
on Stack Overflow
See other posts from Stack Overflow
or by Julius Petraška
Published on 2012-10-09T15:30:18Z
Indexed on
2012/10/09
15:37 UTC
Read the original article
Hit count: 280
I have app, where user drags and drops image, and it is being redrawn with OpenGL
for some aviable processing. Everything works. And when user wants to save his image it works like that:
glReadPixels -> NSBitmapImageRep -> NSData -> Write to file
This works too. Almost. With some images it is not working as it should work.
For example:
.png
when I open and save this image:
I get:
And if I open and save this image:
I get:
.jpg
If I open and save:
I get:
And when I open and save:
I get:
So sometimes images saves badly. Why is it happening?
© Stack Overflow or respective owner