As D-day for the legendary photographer to repay a $24 million loan arrived yesterday, her lawyers were still in talks with her creditors trying to reach a settlement, a knowledgeable source told The Post.

The talks were still ongoing in the late afternoon, and were “fluid,” the source said, meaning the two sides could strike a deal or the talks could completely fall apart at any moment.

If she’s unable to reach some sort of settlement, Leibovitz, 59, will find herself in dire straits.

Leibovitz had put up her entire catalog of work, as well as her homes in Greenwich Village and upstate Rhinebeck, as collateral for the loan, and could lose them all — as well as a chunk of her future earnings — if she’s found in default.

The longtime Vanity Fair photographer — who made her name snapping the likes of John Lennon, Bruce Springsteen and Demi Moore — had taken out the loan in June of last year to get out from under an array of “mortgage obligations, tax liens and unpaid bills to service providers and other creditors,” Art Capital said in court papers.

In December, Leibovitz agreed to let Art Capital be her exclusive agent on sales of her real estate and photos in order to get more cash and a lower interest rate on the loan.

The company said she reneged on both parts of the deal — refusing to allow their agents access to her homes and cutting a side deal with Getty Images to sell some of her pics so she could make a loan payment.

Art Capital filed suit against her in July, seeking to hold her to the terms of her deal.