简体   繁体   中英

Is it possible to download only a specific part of an image (cropping it "on the fly") with wget, so as to avoid downloading large files? If so, how?

I currently frequently download many large images, and then crop them after doing so, needing only small parts of them each time. To me it seems unnecessary to download the parts of the images I don't need at all, and it's really slowing down my workflow. Is there any way to programmatically download files of known image formats in a way that just downloads the parts of them I want cropped out directly? It doesn't have to be with wget , but that's what I'm using now.

AFAIK wget does not have partial download feature. However you can do partial download with curl if the remote server supports it. Example:

curl -r 5-9 https://example.com

downloads bytes between 5 and 9 (inclusive).

However it does not always work: Server support is required. From the curl manual page:

You should also be aware that many HTTP/1.1 servers do not have this feature enabled, so that when you attempt to get a range, you will instead get the whole document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM