The user creates a drawing using my program. I extract that drawing and convert it to a PNG. My code works great. I want to enhance it, and I have a question.
To extract the drawing, I use
glReadPixels( x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dummy );
Now, I want to find the smallest rectangle in the image that contains any part of the user’s drawing. for instance, suppose the user only painted on the leftmost half of the drawing. I want the smallest image that still captures all of the drawing.
I thought I could scan the pixels and look for non-transparent pixels and figure this out?