Closed ghost closed 3 years ago
What data do you need for the illust?
If you want the length and width, you need to query from the search_illust
/user_illusts
. The download
interface can only get the picture size.
I need the actual image data, so what you can currently get by doing this:
api.download("https://i.pximg.net/img-original/img/2020/11/06/02/20/38/85488052_p0.jpg", path=path, name="image.jpg") imagedata = open(f"{path}/image.jpg", 'rb')
This is a pretty ineffective method since it requires saving a file to the hard drive just to open it again, so a direct way to do this would be better, maybe something like imagedata = api.get_file("https://i.pximg.net/img-original/img/2020/11/06/02/20/38/85488052_p0.jpg")
Check this example
You can pass a file-like object to the fname
argument of download()
. It's name is a little confusing but it works.
ohhhhhh, thanks a lot!
Currently you can download a file with api.download(), but i only need to get the file's data to do a bit of post processing, so saving and loading the image is a long step that could be avoided Could you add a function to get a post's image that returned the image data directly?