Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

How do I.....

Post Reply
PhillHS
Posts: 6
Joined: Sun Mar 05, 2023 5:27 pm

How do I.....

Post by PhillHS »

Hi all,

So I have loaded a web page in a browser, and I can get the source to it from my Lazarus code and parese the source. But since the page is loaded and rendered it will have also loaded the images from the website. Is there a way to get the properties of those images programattically e.g. filesize, resolution etc?

Cheers.

Phill.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How do I.....

Post by salvadordf »

Hi,

As far as I know there's no way to know the image properties before downloading them.
You can read the "Content-Length" HTTP header once the download starts but the resource length is not what you asked.
The image attributes in HTML are not always available and the downloaded image can have much different size values.

The only solution I know is to download the image file in order to get the real width, height, etc.
Post Reply