Updated date:

How to Make AI-Generated Art With Style Transfer

Author:

While experimenting with new ways to make digital art, I made an AI art generator webpage. Photos are painted in the style of the 2nd image.

Selfie to renaissance painting using fast AI style transfer.

Selfie to renaissance painting using fast AI style transfer.

AI Art

Computer programs can make art by following simple instructions. The programmer learns how to do something, and then they get a program to do it. I made a program that turns photos into digital oil paintings. The app does a lot of work for you, but it is not smart.

When a program learns how to create art by practicing, it is referred to as AI-generated art. A form of artificial intelligence called deep learning can allow a computer program to get better at a task by doing it over and over again. Before the results are passable or pleasing, the program may need to run thousands of times.

You can quickly get a computer program to create AI art for you by using pre-trained models. Choose a photo or two, press a button, and wait for the program to finish.

Style Transfer

Combining the content of an image with the colors and patterns of another is referred to as style transfer. The result is a painting of the first image in the style of the second. You could get the style from a famous painting or from a picture of your pet.

When I transferred 20 different styles onto a selfie, they all looked like me. It kept the basic shapes of my body and the scenery. The most obvious difference was the colors. In some of the photos, there were a lot of extra lines.

Colored picture in the style of a black and white photo of Sean Connery.

Colored picture in the style of a black and white photo of Sean Connery.

Black-and-White–Style Images

I wanted to see what would happen if I combined a colored photo with a black and white image. It made the photo like a pencil drawing. Most of the color was removed.

When I painted a selfie in the style of a sketch, the result looked like a sketch with some interesting shading. If the background is white or transparent, you may need to zoom in. The white space is transferred to the new image. Too much ruins the effect.

Do a black and white photo in the style of a colored picture to add some color.

Color Switching

To make a picture look more like handmade art, I drew it using 50 crayons. The original RGB values were replaced with the closest match. Reducing the number of colors or grouping pixels together gives you colors that are different but similar to the original.

When colors are switched, they can be totally different. You could end up with green skin. A renaissance painting effect usually makes everybody look pale white because of the pigments used in renaissance paintings.

Switching the colors reduces the realism and makes it look like art. The results are interesting because they don't look like real life. For more realistic results, use an oil painting effect or color reduction.

Photo to digital art in the style of The Scream painting.

Photo to digital art in the style of The Scream painting.

Lines and Patterns

Obvious lines and patterns will be transferred. Extra lines, squares or odd shapes can make the new image look more abstract. Objects may be broken up into smaller parts. The more abstract it becomes, the harder it is to make out the shapes from the original photo.

Pay attention to the lines and other patterns that are repeated over and over again when choosing the style image. Adding unnatural patterns can give you results that stand out. For one of my most abstract pictures, I combined a selfie with a stained glass window.

Contrast and Saturation

Some of the paintings I made were too dull. I fixed them by increasing the contrast and saturation. You may want to quickly edit the image to see if you can make it look better. Saturation is the intensity of the color. Contrast is the difference between light and dark.

Make a good picture great. Seeing if you can improve the image only takes a few seconds. I added canvas filters to the style transfer page I made so the picture could be fixed right away.

Art generation with deep learning. In the style of a stained glass window.

Art generation with deep learning. In the style of a stained glass window.

Dimensions

The program I used to transfer styles was trained using small 256 pixel images. So it works best when using style pictures that are around the same size. Content images can be larger, but the size is limited by the computer's Graphics Processing Unit.

While transferring styles on my laptop, the GPU utilization went from 1% to 100%, and it used most of the available memory. Style transfer is demanding. If the pictures are too big for my computer's GPU, then it fails, and the canvas images disappear. The webpage needs to load again.

At 600x900, large content photos failed, but it worked for 533x800 images. If it does not work, then reload the page and try again. You may need to make the pictures smaller. Other apps and windows could slow it down and limit the available memory. Before you start, close programs that don't need to be running and windows that don't need to be open.

I recommend experimenting with small images. When you find a combination you like, try to make a larger painting.

Is AI-Generated Art Really Art?

You select two pictures, click a button and wait for the program to finish. The AI style transfer program creates a non-photorealistic image of the subject. Then you review the work and decide if it is pleasing to look at.

Art should require time, skill, hard work and creativity. You could argue that it is not art because anybody can do it. But it looks like art and the computer program does a lot of work for you. Before you could use the program someone worked really hard to make it.

Put some effort into taking pictures and choosing pairs of images that will give you interesting results. To make it unique you need to start with unique photos. It will be worth more if it does not look the same as the other images people have made.

I consider it a form of art. Pressing a button does not make you an artist but the computer program is making art with you. The creativity comes from the user.

While making the image below, I decided to zoom in. Cropping the style image gave me a completely different result. Make choices and experiment.

Digital art made by me and an AI art generator app. Stained glass style.

Digital art made by me and an AI art generator app. Stained glass style.

Copyright

Most images are copyrighted. You are modifying the first using the style of the second. If you don't own the copyright or have permission to use the picture then you don't have the right to alter it.

Styles can't be copyrighted. Legally it should be okay to use the ideas, colors and styles from copyrighted photos, drawings and paintings. Use other people's art as inspiration but don't try to copy it. When possible, use your images or ones that are in the public domain.

Don't reduce the value of other people's original copyrighted work by making variations of it.

The art you legally make from other people's images will be copyrighted by you if the changes are significant and transformative. For example, turning a photo into a painting with the style of a stained glass window.

If you want to share the copyrighted images and writing on this page, then share a link. Feel free to pin, tweet or Facebook the photos with a link back to this page.

Style Transfer App

All the style transfer images on this page were made on my AI Style Transfer webpage. I did some research and figured out how to make AI-generated art using a style transfer script. Then I experimented and made some improvements.

  1. Upload a subject photo.
  2. Upload a style photo.
  3. Choose image and canvas sizes.
  4. Change the X & Y values if you want to move the images.
  5. Hit the transfer button when you are ready.
  6. Wait for the program to finish.
  7. Save the new image if you like it.
  8. Experiment with different styles.

The results only change when you change the pictures. Resize an image or load a new one. Zooming in on the second picture by increasing the display size changes the style.

On my computer, the average time to generate the AI art on this page was around 3 minutes. That it is extremely fast or very slow, depending on your perspective. Like using a microwave, it seems to take a long time when you spend the 3 minutes waiting for it to finish.

Use it to create non-photorealistic art that is unlike anything you have made before.

Photo to sketch. My dog plus a sketch of me equals a sketch of my dog.

Photo to sketch. My dog plus a sketch of me equals a sketch of my dog.

Additional Resources

  • How to Turn a Photo Into a Painting or Drawing With ...
    Take a picture with your camera then make it look like a drawing or painting using color filters. Paintings and drawings can be more interesting to look at than regular photos. If you don't have the time, materials or the skill to make art by hand yo
  • Image to ASCII Art: How to Make Text Drawings
    Learn how to make great text images. ASCII art allows you to create pictures that don't look like anything else you have made. Pixel colors are represented by keyboard characters.
  • Best Photo Filters
    Make cool pictures using photo filters. Change the colors to make them look more interesting. Transform your old pictures into new ones. You can do a lot with a digital image.
  • Photo Scanning: Digitize Photos at Home
    Digital images don't degrade and you can do more than just look at them. You can share them, use them in games or turn them into paintings. I tried digitizing old analog photographs at home. See my results.

Turn Ordinary Photos Into Extraordinary Images With AI-Generated Art

Fast AI style transfer is good for making non-photorealistic digital art. It could end up looking like a painting, drawing or sketch. I liked that they were unrealistic versions of the original image. Even when the colors were completely different, I could still see the subject of the original being depicted in the new one.

Expect the unexpected. When using a style picture for the first time, it is hard to predict the results. You will probably need to use a try-and-see approach. After using a style image once, it will be easier to guess how it will look with other pictures.

Since you don't always get what you want or expect, there is a lot of hit and miss. Some of my results looked great. Others were not worth keeping. Most of the results I got were interesting to look at.

The downside is that your computer needs to do a lot of work. Transferring the style of one image to another is slower than other photo-to-art methods I have used, and it requires more memory. I was limited by my computer's graphics processing unit.

Most of the pictures on this page were made using the same content image. While I was experimenting, I painted the same photo using 20 different styles. The subject is the same, but the results are very different.

The internet, your phone and your computer are full of pictures you could use for the style. Experiment to see what you can create. Delete the bad and show off the best ones.

I recommend using style transfer to turn photos into drawings and unrealistic paintings. Make your own AI-generated art. Turn ordinary photos into extraordinary images.

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.

© 2021 Michael H

Related Articles