I want to generate a JPEG from a GeoTIFF file which has a stack of RGB bands. Considering the JPEG won't necessarily have any geo-referencing information about any pixels, how do I get rid of the black borders? I want the data-pixels(the colored ones here) to fit the frame as a rectangle.
I have experimented that the angle of inclination increases as we go to the polar regions from equator.