{"id":1324,"date":"2014-08-01T12:01:19","date_gmt":"2014-08-01T12:01:19","guid":{"rendered":"http:\/\/www.silkstream.net\/blog\/?p=1324"},"modified":"2018-08-03T11:47:09","modified_gmt":"2018-08-03T11:47:09","slug":"tweeting-edited-images-with-twython","status":"publish","type":"post","link":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html","title":{"rendered":"Noob&#8217;s Guide #5: Tweeting Edited Images with Twython"},"content":{"rendered":"<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1335\" alt=\"Noob's Guide to Twython\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/noob-guide-twython-5.png\" width=\"556\" height=\"300\" \/><\/p>\n<p style=\"text-align: justify;\">Welcome to the fifth installment of The Noob&#8217;s Guide to Twython, where we&#8217;re playing around with the Twitter API with Python, using the Twython module. These tutorials are aimed at those who are perhaps learning to code for the first time, or have only a beginner&#8217;s knowledge of Python. If you&#8217;re looking for some advanced stuff, you&#8217;ve come to the wrong place!<\/p>\n<p style=\"text-align: justify;\">This tutorial assumes that you already know <a title=\"How To Get Going with Twython\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/how-to-get-going-with-twython.html\" target=\"_blank\">how to set up your Twython<\/a> for the first time!<\/p>\n<hr \/>\n<p style=\"text-align: justify;\">What was the very first thing we learnt as a Twython noob? Whether you&#8217;ve been following this tutorial from the beginning or not, it probably was how to update your status.<\/p>\n<pre style=\"text-align: center;\"><span style=\"color: #ff6600;\"><strong>twitter.update_status(status=\"Hello world.\")<\/strong><\/span><\/pre>\n<p>Remember how proud you were of those two simple words? Let&#8217;s try to recreate that momentous feeling of pride, but now by updating your Twitter status with your very own custom image!<\/p>\n<p style=\"text-align: justify;\">This is going to be a pretty basic tutorial where we will learn to create a random image generator for Twitter. But using our knowledge from the past tutorials, and the wonders of our own creative imaginations, it&#8217;s easy to expand on this simple bit of example code to go off into the Twitterverse and create your own picture-sharing Twitter bot.<\/p>\n<h2 style=\"text-align: justify;\">Editing Images for your Twitter Status with PIL<\/h2>\n<p style=\"text-align: justify;\">So, as always, before you dive in, let&#8217;s see what you&#8217;re getting into so there&#8217;s no surprises. Then we can break it down into noob-sized chunks.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><span><code><span style=\"color: #ff6600;\"># I'll explain glob and PIL in a moment =]<\/span><span style=\"color: #000000;\">\r\nfrom twython import Twython, TwythonError\r\nimport glob\r\nimport random\r\nfrom PIL import Image, ImageDraw, ImageFont\r\n\r\napp_key = \"YOUR_APP_KEY\"\r\napp_secret = \"YOUR_APP_SECRET\"\r\noauth_token = \"YOUR_OAUTH_TOKEN\"\r\noauth_token_secret = \"YOUR_OAUTH_TOKEN_SECRET\"\r\n\r\ntwitter = Twython(app_key,app_secret,oauth_token,oauth_token_secret)\r\n\r\n<\/span><span style=\"color: #ff6600;\"># Telling Twython where to look for image files<\/span><span style=\"color: #000000;\">\r\nimages = glob.glob(\"images\/*\")\r\n\r\n<\/span><span style=\"color: #ff6600;\"># Check if there are any files in the images directory<\/span><span style=\"color: #000000;\">\r\nif len(images) &gt; 0:\r\n    <\/span><span style=\"color: #ff6600;\"># Request user input for text to add to image<\/span><span style=\"color: #000000;\">\r\n    message = raw_input(\"Text: \")\r\n    <\/span><span style=\"color: #ff6600;\"># Request user input for new Twitter status to Tweet<\/span><span style=\"color: #000000;\">\r\n    new_status = raw_input(\"Update Twitter Status: \")\r\n    <span style=\"color: #ff6600;\"># Open random image from our directory<\/span>\r\n    random_image = Image.open(images[random.randint(0,len(images))-1])\r\n    <span style=\"color: #ff6600;\"># Twitter displays images at 440px width<\/span>\r\n    Width = 440\r\n    <span style=\"color: #ff6600;\"># Calculate size difference between original and 440px<\/span>\r\n    width_percent = (Width\/float(random_image.size[0]))\r\n    <\/span><span style=\"color: #ff6600;\"># Use that percentage to determine the new height to resize<\/span><span style=\"color: #000000;\">\r\n    Height = int((float(random_image.size[1])*float(width_percent)))\r\n    <span style=\"color: #ff6600;\"># Resize image to optimal Twitter size<\/span>\r\n    random_image = random_image.resize((Width,Height), Image.BILINEAR)\r\n    <span style=\"color: #ff6600;\"># Open the image for drawing<\/span>\r\n    draw_image = ImageDraw.Draw(random_image)\r\n    <span style=\"color: #ff6600;\"># Getting the size of our message text<\/span>\r\n    width, height = draw_image.textsize(message)\r\n    <span style=\"color: #ff6600;\"># Setting a funky new font for our message<\/span>\r\n    font = ImageFont.truetype(\"resources\/cool-font.ttf\",50)\r\n    <span style=\"color: #ff6600;\"># Drawing the text onto the image<\/span>\r\n    draw_image.text((20,(Height-height)\/2),message,(255,255,255),font=font)\r\n    <span style=\"color: #ff6600;\"># Saving the image as tweetpic.jpg<\/span>\r\n    random_image.save(\"tweetpic.jpg\")\r\n    <span style=\"color: #ff6600;\"># Opening up the saved image<\/span>\r\n    tweetpic = open(\"tweetpic.jpg\",\"rb\")\r\n    <span style=\"color: #ff6600;\"># Update status with our new image and status!<\/span>\r\n    twitter.update_status_with_media(status=new_status, media=tweetpic)\r\n<span style=\"color: #ff6600;\"># Unless there's no images in the images directory...<\/span>\r\nelse:\r\n    print \"There are no images in that folder.\"<\/span><\/code><\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">It doesn&#8217;t look like much, but there&#8217;s lots of brand new things we haven&#8217;t covered yet.<\/p>\n<p style=\"text-align: justify;\">Before anything else though, you have to check to see whether you have glob and PIL installed. You can do this from the IDLE just by trying to import PIL and glob.<\/p>\n<pre><span style=\"color: #ff6600;\"><strong>&gt;&gt;&gt; import glob\r\n&gt;&gt;&gt; import PIL\r\n<\/strong><\/span><\/pre>\n<p style=\"text-align: justify;\">If it&#8217;s saying that you don&#8217;t have either of those installed, well guess what, you&#8217;re going to have to install them.<\/p>\n<p style=\"text-align: justify;\">If you run Windows, thankfully there are Pillow installers you can download from <a href=\"https:\/\/pypi.python.org\/pypi\/Pillow\/2.2.1#downloads\" target=\"_blank\">here<\/a>\u00a0so you don&#8217;t have to compile it yourself. (That webpage also provides installation instructions for other operating systems too!) Make sure that when you install Pillow (the far more usable Python Imaging Library fork) you download the correct the .exe file for your Windows system and Python version.<\/p>\n<h2 style=\"text-align: justify;\">You probably want to know what PIL and glob are, huh?<\/h2>\n<p style=\"text-align: justify;\">glob is a Python module which makes finding file pathways and stuff a little easier. There are multiple ways you can set file pathways, but glob is simple to use and you don&#8217;t need to get all heavy into regex for very basic pattern matching.<\/p>\n<p style=\"text-align: justify;\">PIL (Python Imaging Library) is becoming a little deprecated now, but there&#8217;s a fork called Pillow that works pretty much exactly the same code-wise, but is a lot more &#8220;friendly&#8221;. Using PIL, you can create images, edit images, etc. I mean, don&#8217;t get me wrong, it&#8217;s no Photoshop but for quick and simple image edits like adding watermarks or text to image, it&#8217;s all we need!<\/p>\n<h2 style=\"text-align: justify;\">Breaking Down The Code&#8230;<\/h2>\n<p style=\"text-align: justify;\">Firstly, in your working directory (the directory which the program you&#8217;re working on is saved), you&#8217;re going to need to create two folders: one called images and one called resources.<\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1326\" alt=\"Images and Resources folders\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/images-resources.png\" width=\"449\" height=\"45\" \/><\/p>\n<p style=\"text-align: justify;\">In the images folder, you can save all of your images that you want to edit and Tweet out in there.<\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1327\" alt=\"Tweet Images\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/tweet-images.png\" width=\"461\" height=\"159\" \/><\/p>\n<p style=\"text-align: justify;\">For this example, I&#8217;ve just downloaded some random images from Google Image Search to our images folder.<\/p>\n<p style=\"text-align: justify;\">In resources, you can save any fonts or other resources you may want to use. For this example, I&#8217;ll be using a font which we&#8217;re just going to call cool-font.ttf. You can find loads of font files and stuff on Da Font or other font download websites.<\/p>\n<p style=\"text-align: justify;\">So let&#8217;s get started!<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><span style=\"color: #000000;\"><code>images = glob.glob(\"images\/*\")<\/code><\/span><\/pre>\n<\/div>\n<p style=\"text-align: justify;\">\n<p style=\"text-align: justify;\">Let&#8217;s create a variable called <span style=\"color: #ff6600;\"><strong>images<\/strong><\/span>\u00a0to tell Twython where to look for our image files. Using glob, we can direct Twython to look for any file in the images folder (so it&#8217;s important to only save image files to this folder). The asterisk (*) generally tends to mean wildcard, as in\u00a0<em>anything<\/em>. glob returns us a list of all the files within that folder. So it&#8217;s like saying <span style=\"color: #ff6600;\"><strong>images = [&#8220;images\/pic1.jpg&#8221;, &#8220;images\/pic2.jpg&#8221;, &#8220;images\/etc.jpg&#8221;]<\/strong><\/span>&#8230;<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><span style=\"color: #000000;\"><code>if len(images) &gt; 0:<\/code><\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Here we are telling Twython to perform the following instructions if the length of our list of images is more than 0, as in if there&#8217;s actually files in that folder.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><span style=\"color: #000000;\"><code>message = raw_input(\"Text: \")\r\nnew_status = raw_input(\"Update Twitter Status: \")<\/code><\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">When the program is executed, it will prompt the user for Text input. The user&#8217;s input from this prompt will be saved as a string to <strong><span style=\"color: #ff6600;\">message<\/span><\/strong>. This is the text that we&#8217;re going to add to our image.<\/p>\n<p style=\"text-align: justify;\">Once something&#8217;s been entered, the program will again prompt the user for input, asking for the new status to update to Twitter. Again, the user&#8217;s new status will get saved as a string to <span style=\"color: #ff6600;\"><strong>new_status<\/strong><\/span>.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>random_image = Image.open(images[random.randint(0,len(images))-1])<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Now we&#8217;re calling on PIL&#8217;s Image module to open a random file from the images folder. Remember how we said that the\u00a0<span style=\"color: #ff6600;\"><strong>images<\/strong><\/span>\u00a0variable is just a list of images? So we can use Python&#8217;s <span style=\"color: #ff6600;\"><strong>random<\/strong><\/span> module to select a random item from the list by randomly selecting a number within the the list&#8217;s index (between 0 and the length of the images list, or how many files in the folder, and then subtracting 1 from the random integer as indexes start from 0).<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>Width = 440\r\nwidth_percent = (Width\/float(random_image.size[0]))<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Next we want to set the <strong><span style=\"color: #ff6600;\">Width<\/span><\/strong> of the image as 440px. This is because Twitter&#8217;s optimal image width is 440px. Twitter&#8217;s optimal image height is 220px, which is all that&#8217;s displayed in the Twitter feed without the user clicking on Expand to see the full image. But the width is certainly the most important. We can use larger images and Twitter will scale them down. But if we use a large image, then add text to it, then have Twitter scale it down for us, what&#8217;s going to happen? The text is going to be smaller than how we want it to be! So we need to resize the image before we add the text. Right now though, we&#8217;re just saving the <span style=\"color: #ff6600;\"><strong>440<\/strong><\/span>\u00a0for later use as we&#8217;re going to need it again.<\/p>\n<p style=\"text-align: justify;\">But then how do we get the height of the image for when we resize? Images are going to have different widths and heights! Well, we need to have our program figure out what height we&#8217;re going to need to resize the image to, according to the given width of 440px. We can do this by getting the <span style=\"color: #ff6600;\"><strong>float<\/strong><\/span> (non-integer basically) of our image&#8217;s original width (the first item that comes up for the <span style=\"color: #ff6600;\"><strong>size[]<\/strong><\/span> is width) and dividing it by our new <span style=\"color: #ff6600;\"><strong>Width<\/strong><\/span> of 440px. That&#8217;s our percentage change in width size &#8211; or <span style=\"color: #ff6600;\"><strong>width_percent<\/strong><\/span>.<\/p>\n<p style=\"text-align: justify;\">So next, we&#8217;ll want to use that <span style=\"color: #ff6600;\"><strong>width_percent<\/strong><\/span> to determine our new <span style=\"color: #ff6600;\"><strong>Height<\/strong><\/span>.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>Height = int((float(random_image.size[1])*float(width_percent)))\r\nrandom_image = random_image.resize((Width,Height), Image.BILINEAR)<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Of course, we need our new <span style=\"color: #ff6600;\"><strong>Height<\/strong><\/span> to be an integer so we enclose our code to return us the height once we work it out in <strong><span style=\"color: #ff6600;\">int()<\/span><\/strong>. To get the height, we&#8217;ll need to use the same bit of code we used last time to get the original width, to get the original height &#8211;\u00a0<span style=\"color: #ff6600;\"><strong>(float(random_image.size[1])<\/strong><\/span>. As you can see, we&#8217;re using the index of 1 instead of 0, as now we&#8217;re going for height and not width. Then we&#8217;re going to multiply our original height by the float of our width percentage difference or <span style=\"color: #ff6600;\"><strong>width_percent<\/strong><\/span>. So really we&#8217;re just doing the exact same thing that we did to convert our original width to 440px.<\/p>\n<p style=\"text-align: center;\"><strong>Yay for basic maths!<\/strong><span style=\"color: #ff6600;\"><strong><br \/>\n<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">So now we have our new <span style=\"color: #ff6600;\"><strong>Width and Height<\/strong><\/span>\u00a0we can change our existing <span style=\"color: #ff6600;\"><strong>random_image<\/strong><\/span> variable to our new resized image. So we get our existing <span style=\"color: #ff6600;\"><strong>random_image<\/strong><\/span> and <span style=\"color: #ff6600;\"><strong>resize<\/strong><\/span> it by our new\u00a0<span style=\"color: #ff6600;\"><strong>Width<\/strong><\/span> and <strong><span style=\"color: #ff6600;\">Height<\/span><\/strong>. The <span style=\"color: #ff6600;\"><strong>Image.BILINEAR<\/strong><\/span>\u00a0parameter is just a method of image scaling in mathematics. There are other scaling methods that you can play around with on your own.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>draw_image = ImageDraw.Draw(random_image)\r\nwidth, height = draw_image.textsize(message)\r\nfont = ImageFont.truetype(\"resources\/cool-font.ttf\",50)\r\ndraw_image.text((20,(Height-height)\/2),message,(255,255,255),font=font)\r\nrandom_image.save(\"tweetpic.jpg\")<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">Now that we have our resized image, we want to open it up for drawing and call it <span style=\"color: #ff6600;\"><strong>draw_image<\/strong><\/span>.<\/p>\n<p style=\"text-align: justify;\">We can get the width and height of the <span style=\"color: #ff6600;\"><strong>message<\/strong><\/span> from<span style=\"color: #ff6600;\"><strong>raw_input<\/strong><\/span> earlier to determine the placement of the message within the image. We&#8217;ll call these <span style=\"color: #ff6600;\"><strong>width<\/strong><\/span> and <span style=\"color: #ff6600;\"><strong>height<\/strong><\/span> in all lower caps so we can differentiate from the image <strong><span style=\"color: #ff6600;\">Width<\/span><\/strong> and <strong><span style=\"color: #ff6600;\">Height<\/span><\/strong>\u00a0where we capitalised the first letter. Notice how instead of <span style=\"color: #ff6600;\"><strong>.size()<\/strong><\/span> we&#8217;re using <strong><span style=\"color: #ff6600;\">.textsize()<\/span><\/strong> now.<\/p>\n<p style=\"text-align: justify;\">We can choose our own font for the message overlay, by using the <strong><span style=\"color: #ff6600;\">Image.Font<\/span><\/strong> module and using the truetype font (.ttf) saved in our resources folder. In this example, we&#8217;re setting out font size to 50, but obviously you can play around with this to find your own optimal font size for whatever your message is. We&#8217;ll save our font settings as <span style=\"color: #ff6600;\"><strong>font<\/strong><\/span>.<\/p>\n<p style=\"text-align: justify;\">Next we&#8217;re going to draw the text onto our image by using <strong><span style=\"color: #ff6600;\">.text()<\/span><\/strong>. The first parameter <span style=\"color: #ff6600;\"><strong>(20, (Height-height)\/2)<\/strong><\/span> gives us the coordinates for where to add the text to the image. For this example, I&#8217;ve combined two different ways in which to do this. On the x coordinate, we&#8217;re adding our text 20px from the left. On the y coordinate, we&#8217;ve done something a little different. We&#8217;re working out the centre-height of the image by subtracting the text&#8217;s height from the image height and dividing that figure by 2.<\/p>\n<p style=\"text-align: justify;\">The second parameter <strong><span style=\"color: #ff6600;\">message<\/span><\/strong>\u00a0is whatever the user inputted as their message to be added to the image. The third \u00a0parameter the font colour we want in RGB, so <span style=\"color: #ff6600;\"><strong>(255,255,255)<\/strong><\/span> gives us white. And finally, the last parameter is setting our font to the font that we&#8217;ve already defined.<\/p>\n<p style=\"text-align: justify;\">That&#8217;s all the image editing done, so now we can save our edited <span style=\"color: #ff6600;\"><strong>random_image<\/strong><\/span> as <span style=\"color: #ff6600;\"><strong>tweetpic.jpg<\/strong><\/span>! This will either create the file tweetpic.jpg as new or, if the image already exists within the working directory from previously running this program, it will replace the existing tweetpic.jpg. So once the image is created and you&#8217;ve Tweeted it out, you don&#8217;t have to delete the new file from your computer.<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>width, height = draw_image.textsize(message)\r\nfont = ImageFont.truetype(\"resources\/cool-font.ttf\",50)\r\ndraw_image.text((20,(Height-height)\/2),message,(255,255,255),font=font)\r\nrandom_image.save(\"tweetpic.jpg\")<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>And last but not least, the moment you&#8217;ve all been waiting for&#8230;<\/p>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><code>tweetpic = open(\"tweetpic.jpg\",\"rb\")\r\ntwitter.update_status_with_media(status=new_status, media=tweetpic)<\/code><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>We open up our new tweetpic.jpg so we can Tweet it. <span style=\"color: #ff6600;\"><strong>&#8220;rb&#8221;<\/strong><\/span> stands for Read Binary which is how we want to open the file for our program to read.<\/p>\n<p>Then we call Twython to <span style=\"color: #ff6600;\"><strong>update_status_with_media<\/strong><\/span> using the <span style=\"color: #ff6600;\"><strong>new_status<\/strong><\/span> that we prompted our user for at the beginning, and attaching our <span style=\"color: #ff6600;\"><strong>tweetpic<\/strong><\/span>!<\/p>\n<h2>Now let&#8217;s run our new image editing Twitter bot!<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1330\" alt=\"Twython PIL input\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/python-pil-twython-input.png\" width=\"279\" height=\"55\" \/><\/p>\n<p>And what do we get&#8230;?<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1331\" alt=\"Twython PIL image tweet\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-pil-image-tweet.png\" width=\"581\" height=\"493\" \/><\/p>\n<p>Awesome.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1332\" alt=\"Twython PIL image edit\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-pil-image-edit.png\" width=\"575\" height=\"337\" \/><\/p>\n<p>I thought this image in particular looked quite cool:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1334\" alt=\"Silkstream Twython Image\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/silkstream-twython-image.png\" width=\"475\" height=\"315\" \/><\/p>\n<h2>So what else can we do with our new Twitter bot?<\/h2>\n<p style=\"text-align: justify;\">The sky&#8217;s the limit really, you just need a little imagination. You can create amazing tools based off of this simple little program.<\/p>\n<ul>\n<li style=\"text-align: justify;\">You could upload all your company photos and Tweet them out randomly with your company name as a watermark in the corner of the images.<\/li>\n<li style=\"text-align: justify;\">You could create a list of different motivational quotes, and have them Tweeted out randomly and embedded onto a random motivational image, deleting each quote and each image after it&#8217;s used, creating a unique motivational image generator. You could even style it to be in the same format as the motivational poster memes. In fact, you could just create uniquely generated memes and to heck with motivational!<\/li>\n<li style=\"text-align: justify;\">Get a cool folder of different backgrounds and have a random fact or tip Tweeted out multiple times a day related to your company industry. Check out one of our previous posts &#8220;<a title=\"Random Tweets with Twython\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/random-tweets-with-twython.html\" target=\"_blank\">Random Tweets with Twython<\/a>&#8221; for help on how to Tweet random quotes or messages!<\/li>\n<li style=\"text-align: justify;\">You could have the program <a title=\"ReTweeting with your Twython Twitter Bot\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/retweeting-with-your-twython-twitter-bot.html\" target=\"_blank\">listen out for a specific hashtag<\/a>\u00a0and respond to the Tweet within the image. For example, you could create a branded hashtag like #PicMePlz and so people could Tweet:<br \/>\n<strong><a title=\"\u201cContent is King\u201d \u2013 Bill Gates, 1996\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/07\/content-is-king-bill-gates-1996.html\" target=\"_blank\">&#8220;Content is King&#8221; &#8211; Bill Gates, 1996<\/a>\u00a0http:\/\/imgsite.com\/billgates.jpg #PicMePlz<\/strong><br \/>\nand then your program goes off and downloads the image from the specific website, resizes it and adds <em>&#8220;Content is King&#8221; &#8211; Bill Gates, 1996<\/em>\u00a0to the top or bottom of the image. Then replies to the user with:<br \/>\n<strong>For @TwitterUser: &#8220;Content is King&#8221; &#8211; Bill Gates, 1996 #PicMePlz<br \/>\n<\/strong>with their image attached.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Whatever you use this code tutorial for, have fun and don&#8217;t forget to share with your code creations with us on Twitter <a href=\"https:\/\/twitter.com\/silkstreamnet\" target=\"_blank\">@Silkstreamnet<\/a>!<\/p>\n<h2 style=\"text-align: justify;\">Your final code should look like this:<\/h2>\n<div style=\"border: dashed #f79239; padding: 8px;\">\n<pre><span style=\"color: #000000;\"><code>from twython import Twython, TwythonError\r\nimport glob\r\nimport random\r\nfrom PIL import Image, ImageDraw, ImageFont\r\n\r\napp_key = \"YOUR_APP_KEY\"\r\napp_secret = \"YOUR_APP_SECRET\"\r\noauth_token = \"YOUR_OAUTH_TOKEN\"\r\noauth_token_secret = \"YOUR_OAUTH_TOKEN_SECRET\"\r\n\r\ntwitter = Twython(app_key,app_secret,oauth_token,oauth_token_secret)\r\n\r\nimages = glob.glob(\"images\/*\")\r\n\r\nif len(images) &gt; 0:\r\n    message = raw_input(\"Text: \")\r\n    new_status = raw_input(\"Update Twitter Status: \")\r\n    random_image = Image.open(images[random.randint(0,len(images))-1])\r\n    Width = 440\r\n    width_percent = (Width\/float(random_image.size[0]))\r\n    Height = int((float(random_image.size[1])*float(width_percent)))\r\n    random_image = random_image.resize((Width,Height), Image.BILINEAR)\r\n    draw_image = ImageDraw.Draw(random_image)\r\n    width, height = draw_image.textsize(message)\r\n    font = ImageFont.truetype(\"resources\/cool-font.ttf\",50)\r\n    draw_image.text((20,(Height-height)\/2),message,(255,255,255),font=font)\r\n    random_image.save(\"tweetpic.jpg\")\r\n    tweetpic = open(\"tweetpic.jpg\",\"rb\")\r\n    twitter.update_status_with_media(status=new_status, media=tweetpic)\r\nelse:\r\n    print \"There are no images in that folder.\"<\/code><\/span><\/pre>\n<\/div>\n<h3 style=\"text-align: center;\"><a title=\"Playing with Followers with Twython\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/playing-with-followers-with-twython-csv.html\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1009 alignleft\" alt=\"How To Get Going With Twython\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/06\/orange-arrow-left.png\" width=\"127\" height=\"120\" \/><\/a><a title=\"Playing with Followers with Twython\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/playing-with-followers-with-twython-csv.html\">The Noob&#8217;s Guide to Twython &#8211; Part 5:<\/a><\/h3>\n<p style=\"text-align: center;\"><strong><a title=\"Playing with Followers with Twython\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/06\/playing-with-followers-with-twython-csv.html\">Playing with Followers with Twython<\/a><\/strong><\/p>\n<h3 style=\"text-align: center;\">The Noob&#8217;s Guide to Twython &#8211; Part 6:<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1010 alignright\" alt=\"\" src=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/06\/orange-arrow-right.png\" width=\"127\" height=\"120\" \/><\/h3>\n<p style=\"text-align: center;\"><strong>Coming Soon!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\nWelcome to the fifth installment of The Noob&#8217;s Guide to Twython, where we&#8217;re playing around with the Twitter API with Python, using the Twython <\/p>\n","protected":false},"author":7,"featured_media":1336,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[],"class_list":["post-1324","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-online-marketing","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Noob&#039;s Guide #5: Tweeting Edited Images with Twython - Silkstream<\/title>\n<meta name=\"description\" content=\"The fifth part of our Noob&#039;s Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Noob&#039;s Guide #5: Tweeting Edited Images with Twython - Silkstream\" \/>\n<meta property=\"og:description\" content=\"The fifth part of our Noob&#039;s Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html\" \/>\n<meta property=\"og:site_name\" content=\"Silkstream\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/silkstream\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-01T12:01:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-08-03T11:47:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"120\" \/>\n\t<meta property=\"og:image:height\" content=\"120\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ria\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@RiaLolwut\" \/>\n<meta name=\"twitter:site\" content=\"@silkstreamnet\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ria\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html\"},\"author\":{\"name\":\"Ria\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/#\\\/schema\\\/person\\\/1516b66b9d6da001d8052655282481b1\"},\"headline\":\"Noob&#8217;s Guide #5: Tweeting Edited Images with Twython\",\"datePublished\":\"2014-08-01T12:01:19+00:00\",\"dateModified\":\"2018-08-03T11:47:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html\"},\"wordCount\":2087,\"commentCount\":18,\"image\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/twython-guide-thumb-5.png\",\"articleSection\":[\"Online Marketing\",\"Tutorials\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html\",\"url\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html\",\"name\":\"Noob's Guide #5: Tweeting Edited Images with Twython - Silkstream\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/twython-guide-thumb-5.png\",\"datePublished\":\"2014-08-01T12:01:19+00:00\",\"dateModified\":\"2018-08-03T11:47:09+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/#\\\/schema\\\/person\\\/1516b66b9d6da001d8052655282481b1\"},\"description\":\"The fifth part of our Noob's Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#primaryimage\",\"url\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/twython-guide-thumb-5.png\",\"contentUrl\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/twython-guide-thumb-5.png\",\"width\":120,\"height\":120,\"caption\":\"Noob's Guide to Twython\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/2014\\\/08\\\/tweeting-edited-images-with-twython.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.silkstream.net\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Noob&#8217;s Guide #5: Tweeting Edited Images with Twython\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/\",\"name\":\"Silkstream\",\"description\":\"Here you&#039;ll find the latest blogs, white papers and case studies from Silkstream experts.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.silkstream.net\\\/blog\\\/#\\\/schema\\\/person\\\/1516b66b9d6da001d8052655282481b1\",\"name\":\"Ria\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g\",\"caption\":\"Ria\"},\"description\":\"SEO &amp; Internet Marketing addict, and aspiring crazy cat lady.\",\"sameAs\":[\"http:\\\/\\\/www.silkstream.net\",\"https:\\\/\\\/x.com\\\/RiaLolwut\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Noob's Guide #5: Tweeting Edited Images with Twython - Silkstream","description":"The fifth part of our Noob's Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html","og_locale":"en_GB","og_type":"article","og_title":"Noob's Guide #5: Tweeting Edited Images with Twython - Silkstream","og_description":"The fifth part of our Noob's Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!","og_url":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html","og_site_name":"Silkstream","article_publisher":"https:\/\/www.facebook.com\/silkstream","article_published_time":"2014-08-01T12:01:19+00:00","article_modified_time":"2018-08-03T11:47:09+00:00","og_image":[{"width":120,"height":120,"url":"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png","type":"image\/png"}],"author":"Ria","twitter_card":"summary_large_image","twitter_creator":"@RiaLolwut","twitter_site":"@silkstreamnet","twitter_misc":{"Written by":"Ria","Estimated reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#article","isPartOf":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html"},"author":{"name":"Ria","@id":"https:\/\/www.silkstream.net\/blog\/#\/schema\/person\/1516b66b9d6da001d8052655282481b1"},"headline":"Noob&#8217;s Guide #5: Tweeting Edited Images with Twython","datePublished":"2014-08-01T12:01:19+00:00","dateModified":"2018-08-03T11:47:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html"},"wordCount":2087,"commentCount":18,"image":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#primaryimage"},"thumbnailUrl":"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png","articleSection":["Online Marketing","Tutorials"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html","url":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html","name":"Noob's Guide #5: Tweeting Edited Images with Twython - Silkstream","isPartOf":{"@id":"https:\/\/www.silkstream.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#primaryimage"},"image":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#primaryimage"},"thumbnailUrl":"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png","datePublished":"2014-08-01T12:01:19+00:00","dateModified":"2018-08-03T11:47:09+00:00","author":{"@id":"https:\/\/www.silkstream.net\/blog\/#\/schema\/person\/1516b66b9d6da001d8052655282481b1"},"description":"The fifth part of our Noob's Guide To Twython, where we will be editing and adding text to images using PIL and then Tweeting them out to our Followers!","breadcrumb":{"@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#primaryimage","url":"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png","contentUrl":"https:\/\/www.silkstream.net\/blog\/wp-content\/uploads\/2014\/08\/twython-guide-thumb-5.png","width":120,"height":120,"caption":"Noob's Guide to Twython"},{"@type":"BreadcrumbList","@id":"https:\/\/www.silkstream.net\/blog\/2014\/08\/tweeting-edited-images-with-twython.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silkstream.net\/blog"},{"@type":"ListItem","position":2,"name":"Noob&#8217;s Guide #5: Tweeting Edited Images with Twython"}]},{"@type":"WebSite","@id":"https:\/\/www.silkstream.net\/blog\/#website","url":"https:\/\/www.silkstream.net\/blog\/","name":"Silkstream","description":"Here you&#039;ll find the latest blogs, white papers and case studies from Silkstream experts.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.silkstream.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.silkstream.net\/blog\/#\/schema\/person\/1516b66b9d6da001d8052655282481b1","name":"Ria","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dad9acd650d88d7fd9c7e2b77f38d25ec2c921eb7efb622d785820719d8a75df?s=96&d=mm&r=g","caption":"Ria"},"description":"SEO &amp; Internet Marketing addict, and aspiring crazy cat lady.","sameAs":["http:\/\/www.silkstream.net","https:\/\/x.com\/RiaLolwut"]}]}},"_links":{"self":[{"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/posts\/1324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/comments?post=1324"}],"version-history":[{"count":9,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/posts\/1324\/revisions"}],"predecessor-version":[{"id":5298,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/posts\/1324\/revisions\/5298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/media\/1336"}],"wp:attachment":[{"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/media?parent=1324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/categories?post=1324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silkstream.net\/blog\/wp-json\/wp\/v2\/tags?post=1324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}