{"action":"created","issue":{"url":"https://api.github.com/repos/instaloader/instaloader/issues/110","repository_url":"https://api.github.com/repos/instaloader/instaloader","labels_url":"https://api.github.com/repos/instaloader/instaloader/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/instaloader/instaloader/issues/110/comments","events_url":"https://api.github.com/repos/instaloader/instaloader/issues/110/events","html_url":"https://github.com/instaloader/instaloader/issues/110","id":319719249,"number":110,"title":"Add caption to downloaded images","user":{"login":"aseques","id":555542,"avatar_url":"https://avatars1.githubusercontent.com/u/555542?v=4","gravatar_id":"","url":"https://api.github.com/users/aseques","html_url":"https://github.com/aseques","followers_url":"https://api.github.com/users/aseques/followers","following_url":"https://api.github.com/users/aseques/following{/other_user}","gists_url":"https://api.github.com/users/aseques/gists{/gist_id}","starred_url":"https://api.github.com/users/aseques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aseques/subscriptions","organizations_url":"https://api.github.com/users/aseques/orgs","repos_url":"https://api.github.com/users/aseques/repos","events_url":"https://api.github.com/users/aseques/events{/privacy}","received_events_url":"https://api.github.com/users/aseques/received_events","type":"User","site_admin":false},"labels":[{"id":393097487,"url":"https://api.github.com/repos/instaloader/instaloader/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-02T21:30:36Z","updated_at":"2018-05-09T14:13:49Z","closed_at":null,"author_association":"NONE","body":"I want to stream my feed pictures in a bigger screen, so I would like to add the caption to the downloaded pictures. Is there such feature build in instaloader (couldn't find it in the docs), what would you recommend otherwise?"},"comment":{"url":"https://api.github.com/repos/instaloader/instaloader/issues/comments/387752877","html_url":"https://github.com/instaloader/instaloader/issues/110#issuecomment-387752877","issue_url":"https://api.github.com/repos/instaloader/instaloader/issues/110","id":387752877,"user":{"login":"aandergr","id":17130992,"avatar_url":"https://avatars0.githubusercontent.com/u/17130992?v=4","gravatar_id":"","url":"https://api.github.com/users/aandergr","html_url":"https://github.com/aandergr","followers_url":"https://api.github.com/users/aandergr/followers","following_url":"https://api.github.com/users/aandergr/following{/other_user}","gists_url":"https://api.github.com/users/aandergr/gists{/gist_id}","starred_url":"https://api.github.com/users/aandergr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aandergr/subscriptions","organizations_url":"https://api.github.com/users/aandergr/orgs","repos_url":"https://api.github.com/users/aandergr/repos","events_url":"https://api.github.com/users/aandergr/events{/privacy}","received_events_url":"https://api.github.com/users/aandergr/received_events","type":"User","site_admin":false},"created_at":"2018-05-09T14:13:49Z","updated_at":"2018-05-09T14:13:49Z","author_association":"OWNER","body":"Instaloader does not modify the downloaded JPEG file. However, you could combine it with an imaging library such as Pillow or PIL to render the Post.caption on pictures. An approach could be\r\n\r\n```python\r\nfrom io import BytesIO\r\n\r\nfrom requests import get\r\nfrom PIL import Image, ImageDraw\r\nfrom instaloader import *\r\n\r\nL = Instaloader()\r\n\r\n# Load Post instance\r\npost = load_structure_from_file(L.context, '2017-10-01_18-53-03_UTC.json.xz')\r\n# or post = Post.from_shortcode(L.context, SHORTCODE)\r\n\r\n# Render caption\r\nimage = Image.open(BytesIO(get(post.url).content))\r\ndraw = ImageDraw.Draw(image)\r\ndraw.text((300,100), post.caption.encode('latin1', errors='ignore'))\r\n\r\n# Save image\r\nimage.save('test.jpg')\r\n```\r\n\r\nHowever, this is just an approach. See e.g. https://pillow.readthedocs.io/en/5.1.x/index.html for how to modify images with Python (there are plenty more libraries tough). Instaloader exports a picture's URL as Post.url and its caption as Post.caption."}}
{"actor":{"display_login":"aandergr"}}