I'm looking to get the dimensions, width and height, of a remotely hosted JPG. I have seen how it is possible to do this by downloading the full image.
However, it would be ideal if I could do this by downloading only enough to just get this information.
Typical images are 200K in size and reading in just a few K might at the beginning might be enough for JPGs:
curl_setopt($ch, CURLOPT_RANGE, "0-4096");
For reference, I've followed these answers/comments but to no avail (though they might be on the right track):
Has anyone been able to put the pieces together (withor without ImageMagick)?
Digital Imaging Tutorial - Basic Terminology. FILE SIZE is calculated by multiplying the surface area of a document (height x width) to be scanned by the bit depth and the dpi2. Because image file size is represented in bytes, which are made up of 8 bits, divide this figure by 8.
Check the resolution of your pictures before sending On a computer, right-click on the picture file, open “Properties”. Navigate to the “Details” tab and scroll down to the “Image” section. Here you will see the dimensions (in pixels), the width, and the height of the picture.
Image Properties in Windows Explorer If you right-click an image file in Windows Explorer and select Properties, you obtain the image information with the pixel size. You can see how many pixels the image is made up of, and the image resolution.
How about using ImageMagick's ping
functionality like this:
identify -ping -format "%wx%h" http://www.google.com/logos/giroux1.jpg
482x142
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With