The story starts in 1750, when the Venetian Republic decided to give the city an academy for painters and sculptors. Its first director was the painter Giovanni Battista Piazzetta, and the academy began in a building called the Fonteghetto della Farina, near the landing at Saint Mark's. The move to this spot came with Napoleon. After the fall of the Republic, the Santa Maria della Carità complex passed to the state. In 1807, by Napoleonic edict, it became home to the academy, which was renamed the Royal Academy of Fine Arts, and to its gallery. That is why the museum carries the academy's name even though it began as a teaching collection. The gallery opened to the public in 1817, after major works to adapt the historic rooms, and it drew crowds of visitors. For decades the school managed it. Then, in 1879, the two institutions separated, though they kept sharing the same former monastery, church and school buildings. The academy finally left in 2004, freeing space that was renovated for the needs of a modern museum.