What's The Prompt For That AI Image? (Here's the Trick)

This content was created by LARRUZ. This content was uploaded by LARRUZ. This is a YouTube tutorial titled "What's The Prompt For That AI Image? (Here's the Trick)" (created 2023-04-04). Presenter Sam demonstrates how to reverse-engineer prompts from AI-generated images using three approaches: reading embedded Stable Diffusion PNG metadata (PNG info), using the Hugging Face CLIP Interrogator, and MidJourney's Describe (/describe) feature. He walks through hands-on examples (thumbnails and images referencing Dominic Cooper, Margot Robbie, Snoop Dogg, a house-on-a-hill cityscape, and a colorful vector deer), shows extracted generation parameters (seed, sampler, steps, CFG scale, dimensions, controlnet usage, negative prompts), compares results from Stable Diffusion and MidJourney (v4 and v5), and offers practical tips and resources (links, FutureTools IO, newsletter) for reproducing similar images.
Chapters
In this video I'm going to show you how to reverse engineer images and try to figure out what prompt was used to get that image. So let's get into it now. One of the most common questions that I seem to get asked is if you find an image that you like that you know was AI generated, how do I figure out what they use to generate that and reverse engineer it and generate my own similar image? So there's no super accurate way to do that yet. That's 100% perfect. Perfect. But Mid Journey just rolled out a tool to do that. You can do it inside of stable diffusion directly. And there's another existing tool over on Hugging Face that will also do this for you. So I'm going to break down these three different methods in this super quick video and show you how you can try to reverse engineer some of these images that you come across. So if you're using stable diffusion either locally on your computer, or if you're using something like run diffusion, this works in both of those. There's actually a function called PNG info that you can find in either one of these here. If you know an image was generated with stable diffusion and you drag it into this PNG info here, there's a chance that it will tell you the exact prompt that was used to make it. Here's a little sneak behind the scenes of all of the various images that I generate to try to make my thumbnails. But I know all of these were made in stable diffusion. So if I take one of these images and I grab it and I drop it into this PNG info tab right here. Look what it does over here on the right side. This is the exact prompt that I did. It's not even guessing, it's telling me the exact prompt prompt that I used a photo of Dominic Cooper when I trained it. I trained it using the name Dominic Cooper instead of my own name because I was following a tutorial that I don't believe was accurate. But it is what it is. Thinking Scratching Head Digital Painting Art Station Concept Art Smooth Sharp focus Illustration Art by Art Germ Donato Giancola and Joseph Christian Laidnecker Ross Tran Wlop Negative prompt. You know I've got all of these negative prompts in here. 40 sampling steps sampler Euler a CFG scale 7. The exact seed. I used the image dimension 768 by 512. The noising strength Mask blur. All of it, all of that info is in here. I can actually send this to text to image and it will automatically plug in all of the exact same data from the last time I generated this image. Now, I happen to know this image was also using control. Net to get the pose. So it won't actually generate the exact same image this time unless I'm actually plugging in the same image into my control. Net as well to get the pose, but it should generate something fairly close. Now, if you do drop an image that you know was made with stable diffusion in here and it doesn't generate these parameters for you, it's because whoever generated it didn't set up their settings. So if you come into your settings over here, you need to make sure that this saved text information about generation parameters as chunks to PNG files is selected. If this is selected, it actually saves all of this information to your PNG file. This is really helpful if you generate a lot of your own images in stable diffusion and you want to make sure you can recreate images that look similar every single time. So when I'm making images for my YouTube thumbnails, I usually drag and drop one of my previous images in here, grab the parameter, send it to text to image, and that is what gives me a consistent style every single time. So that's the first method and that's the most accurate method if the image itself had all of this text data encoded into it properly inside of the settings. Now, the second method is through the hugging face. Clip interrogator. This you can literally drag and drop any image you want in. It could be a real image, it can be a stable diffusion image, an image made with mid journey, it doesn't matter. You could drop any image you want in here and it will try to guess a sort of prompt that will generate a similar image to it. Now, in order to find this clip interrogator, you can come up to spaces and then in the search box type clip interrogator. And you'll notice a lot of these say runtime error. Runtime error. Runtime error, paused runtime error. So a lot of these clip interrogators don't work. So what I did was I sorted by most likes and you can see this first one shows a runtime error. This second one shows that it's running right now and it's called CLIP Interrogator 2. I'm going to go ahead and click on this one. I'll make sure I link this specific one in the comments below. But there's also a chance that by the time you see this video, this one might not be working. And you might need to search for a different one to make it work. So just keep that in mind. And this one's real simple. All you're going to do is drag and drop an image straight into this hugging face space here. So let me grab a random AI image that I generated at some point. Let's say this girl with the lightsaber here. And let's just pull this one in. Click submit. Gonna take a little less than a minute. And we should have an idea of the prompt that was used to make this image. And here we go. It says a close up of a person holding a lightsaber by Ross Tran. Fantasy art neon operator Margot Robbie. Blonde female Jedi, Yuri Shudoff and Tom Bagshaw. Epic character portrait. So I can literally take this prompt here, copy it, we could jump into stable diffusion, paste it in, and theoretically we'll get something to somewhat close. Now, I happen to know that this image was made in mid journey because I was the one who generated it. But let's see what stable diffusion gives us when we prompt this exact image. I'm going to up my sampling steps here. I like to do a batch of four, and let's just generate it and see what it comes up with. And this is what it generated. I mean, it's not the exact image. You can tell it tried to model Margot Robbie's face. And this original image was not Margot Robbie. If you look at this and you look at this, they're pretty damn close, honestly. Now let's go ahead and take this same prompt and toss it into mid journey and see what it generates. So if I come over here and type, imagine, paste that same thing in, you can see it generated something somewhat close. So if we take a look at that versus this here, they're not too far off. I mean, maybe slightly different color palettes, but conceptually they're pretty damn close. Now let's go ahead and try this. With Midjourney version 5. I still tend to use v4 as my default and only use v5 when I specifically ask it to. And here's what it generated this time. So take a peek at that versus our original image that we put in. And again, conceptually, pretty dang close. Just for fun, let's try one more. I got this image of Snoop Dogg here that I generated in mid journey. Let's see what happens when I test this one out. Pull this in, go ahead and submit it, and here's what we get. A man in a hoodie smoking a cigarette. Vector art inspired by Sam Spratt. Portrait of Snoop Dogg. Professional Photoshop artwork. Wojtek Fus portrait of Mario. Huh? Let's go ahead and just see what this does inside a Stable Diffusion here. Just fun paste that in, see what it generates for us. Same time, let's go ahead and post this one into Mid Journey. And here's what we got outta Stable Diffusion. We got this, this, this and that. Here's what Midjourney version 4 generated for us. Actually not too bad if you look at this top right one here compared to this, pretty dang close, honestly. Here's Midjourney version 5. I mean, if you look at this top left, this bottom right compared to this, it's pretty close with the output it gave us. All right, so the last one I want to show you. Shout out to Marcos. You can find him at FollowMarcos on Twitter. He pointed out that Midjourney just opened up their own version called dscryb where you can have it try to describe an image sees directly inside of Mid Journey. Now I jumped into Mid Journey and sure enough, inside of the announcements from today, introducing Describe for image to text on Mid Journey, Use the slash describe command and upload an image to get four text prompts to try to describe the image. Click the buttons underneath the commands to generate images for each prompt. So let's go ahead. I'm going to create a new text channel here for Describe test. So let's go ahead and type slash, test, describe. And then these images I know were all made with Mid Journey here. So we'll go ahead and test some of these images. Go ahead and test with this one here of this house on a hill overlooking a city. I believe it was supposed to be Los Angeles. Let's drag this right into this box here and have it try to describe this for us. All right, so that was actually pretty quick. A house perched on a cliff overlooking a sunset in the style of Hollywood glamour, brutalism, highly detailed cityscapes. A house stacked on top of a cliff at sunset in Defiance, in the style of retro Hollywood. All of these seem to pick up that this was kind of Hollywood. So let's go ahead and have it generate each one of these for us and see how close they are to the original image. Okay, so here's the original image just as a reminder. And here's what it generated. Pretty dang close. I mean, kind of different angles, slightly different skylines and sunsets. The house looks different, but that compared to this, you could tell it's pretty much got the same feel, color palette. All of that so that was the first batch. Let's see what the second prompt generated. Here's what the second prompt it described for us generated slightly different color palette. Less of the city skyline in the background, but the house on the hill. I mean, pretty damn similar conceptually. Here's our original image. Again, let's see what our third prompt got us. Here's the third prompt that it generated. A little bit darker in the day, a little bit kind of going into evening time. But this one, you've actually got the skyline in the background. You could see that it's on a hillside overlooking a city. I mean, this one almost looks like it could be the same house from a different angle. Once again, here's our original, and let's see what the fourth one that it gave us looks like. So this is the original, and here's the fourth prompt that it gave us. This one's probably the furthest away. It kind of made a circular house on all of them. None of them really have the skyline or as much of a sunset, but still similar conceptually. A house up on the hill. The first three did a pretty dang good job. Here's the original. Here's the first prompt that it suggested. Pretty dang close. Here's the second prompt that it suggested, and here's the third prompt that it suggested. So let's try one more mid journey image and see if we can reverse engineer it here. This time, let's take this colorful vector deer image that was also made in mid journey and see if we can get it to describe this and come up with something similar. We'll go ahead and type describe. It'll give us a little box to drag our image in. I'll drag my deer image over here and let's go ahead and submit it. A colorful landscape depicting a deer in the mountain area in the style of faceted shapes, like lifelike avian illustration, bold color usage, dark Diane and amber outdoor scene, flat perspective, detailed patterns. Aspect ratio 7, 4. All right, just go ahead and generate each of these and see how close it gets to our initial image. All right, so once again, here is our original image of the deer with the colorful mountains. Here's what the first prompt gave us. I mean, honestly, it looks better than the original. Same concept with the sort of geometric shapes in the image, but I almost like this color palette better. And the deers definitely look better. Here's the original. Here's the second generation that it came up with based on that prompt a little bit further away. In my opinion, I almost like the original color scheme a little bit better. Here's the original image once again. And here's the generation from the third prompt. It gave us a little bit further away from the geometric shapes. You got the geometric shapes in the deer in this one, but really cool color scheme. Definitely grabbing the concept and the idea of it, but getting a little bit further away. Here's the original one more time. And here's the fourth generation, which in my opinion looks really, really cool. I especially like this third one down here. This one looks awesome. I'd say the first generation looks the closest to my original. So here was the original idea, here was first set of generations that it came up with. I mean it was pretty much able to figure out what the prompt was pretty damn close. So there you have it. There's a handful of ways that you can try to reverse engineer images that were made with AI and figure out as close as you possibly can what the original prompt was and then create very similar images. By doing this. You'll learn a bunch of different artist names, a bunch of different styles that you can try, a bunch of different prompt tricks and techniques that you can use and just genuinely add to your toolbox of image generation prompts. So hopefully you found this video helpful. Again, this was one of the most asked questions people would ask me over on Twitter. Everybody seems to want to know how to reverse engineer really cool AI prompts. Those are pretty much the best that we've got right now to do it. If you enjoyed this video, give it a thumbs up. That'll make sure you see more videos like it in your feed. And if you're not already, maybe subscribe to the channel. Because I'm putting out videos like this almost every single day. And if you want to nerd out with me over even more cool AI Tools, check out FutureTools IO. This is where I curate all of the cool AI tools that I come across. It's totally free to use. It's got some really cool faceted navigation so you can find the exact tool that you're looking for if there's just too many tools and it's too overwhelming. Join the free Newsletter Every Friday I'll give you the TLDR of the Week in AI. I'll send you the five coolest tools that I came across, a handful of news articles, a handful of YouTube videos, and one cool way to make money with AI. I send it out every Friday. I don't send any other emails to you throughout the week, just the one. And it'll keep you in the loop with just one simple email per week. You could find it all over at FutureTools IO. So thank you so much for tuning in. I really, really appreciate you. I love the fact that there's so many people loving and nerding out about all this cool AI tech that's rapidly accelerating lately. I'm having so much fun with it. I hope you're really enjoying these kinds of videos and how much fun all of this cool stuff is. And once again, I really appreciate you. I'll see you guys in the next video. Bye. By. Sam.










