  We introduce a novel algorithm, $\textit{COD}$ -- Compact Opacity
Distribution, for shape reconstruction of a celestial body that has been
observed to occult a star, using the photometric time-series observations of
the occultation. $\textit{COD}$ finds a solution to the light-curve inversion
problem for an optically thick occulter having an approximately convex shape,
together with an estimate of its size, impact parameter and velocity, relative
to the occulted star. The algorithm is based on an optimization scheme that
uses topological constraints and an objective function for the geometry of the
occulter. The constraints of the problem follow linear relations, which enable
the use of linear programming optimization as the mathematical framework.
Multiple tests of the algorithm were performed, all of which resulted in high
correlations between the simulated and obtained shapes of the occulting
objects, with errors within $5\%$ in their projected velocities and horizontal
sizes, and within $0.1$ in their impact parameters. These tests include a video
of a solar eclipse by Phobos, as seen by NASA's Curiosity rover, which was
collapsed into its corresponding light curve and reconstructed afterwards. We
applied $\textit{COD}$ to the mysterious case of VVV-WIT-08 -- a single deep
occultation ($\sim 96 \%$) of a giant star lasting for over 200 days. The
analysis, which did not assume any specific shape of the occulter, suggested an
object with a projected opacity distribution resembling an ellipse with an
eccentricity of $\sim 0.5$, tilted at $\sim 30$ degrees relative to the
direction of motion, with a semi-minor axis similar to the stellar radius.
