> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lovable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Using images in Lovable

> Upload images to chat, replace them with visual edits, use external URLs, or add files from your GitHub public directory.

<head>
  <script type="application/ld+json">
    {`{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Upload the image to the prompt chat", "acceptedAnswer": {"@type": "Answer", "text": "Simply upload them in the chat and explain to Lovable’s Agent where and how you’d like them to appear in your project. For example: > Replace the logo in navbar with this image"}}, {"@type": "Question", "name": "Replace it on the visual editor", "acceptedAnswer": {"@type": "Answer", "text": "You can replace an existing image directly using the visual editor functionality: Click on \\"Edit\\" tool. Select the image holder you would like to change. !Visual editor showing an image element selected with the edit panel open Change the image. !Image replacement dialog in visual editor with upload and URL options"}}, {"@type": "Question", "name": "Using an external image URL", "acceptedAnswer": {"@type": "Answer", "text": "One way to add images to your project is by referencing an image from an external URL. This method allows you to use images hosted on external platforms like Unsplash, Imgur, or any other image-hosting service. Be mindful of use copyrights! Here’s how to prompt Lovable to use an external image: Find the image you want to use. For example, you can visit a site like Unsplash, select an image, and copy its URL. In your project prompt, simply tell Lovable to use that image by specifying the URL. For example:"}}, {"@type": "Question", "name": "Using images from your GitHub public directory", "acceptedAnswer": {"@type": "Answer", "text": "Another method to add images to your Lovable project is by using images uploaded to the public directory of your connected GitHub repository. Here’s how you can do it: Ensure your project is connected to your GitHub repo. Here's how to connect your repo. Inside your GitHub repository, navigate to the public directory. This folder is typically used for hosting assets like images that can be referenced in your project. Click on Add file and then from a dropdown, select Upload files option. The next step is to transfer your image to your repo: - Drag and drop the image into the public folder, or - Click on the \\"choose your files\\" link to browse and select the image file. After selecting your image, write a simple commit message (e.g., \\"Adding image files to be used in the app\\") and click \\"Commit changes\\" to save the file to your repo. Once the file is uploaded, select it and then click on the copy icon next to the file name to copy the image’s path. This path will be used in your Lovable prompt. You can now reference this image in your project by using a prompt like the following: Be sure to use your image name and path you copied in the previous step. Uploading large images to your GitHub repo can cause it to grow in size, which can affect Lovable performance (longer repo cloning times, slower startup of previews/sandbox). Try to optimize your images before uploading them to your public folder by compressing them and using dimensions that are relevant to your use case. For example, don't use a full HD-sized image if it will only be displayed as a small icon. To help you better understand how to integrate images using the methods outlined above, we have a project you can explore: Lovable Project Example. In this project, you can see the actual prompts and how each method works in practice. Additionally, here's a public GitHub repository that includes the commits, uploaded images, and full implementation details. You can view the repository here: GitHub: Adding Images Example. Feel free to explore the project and repository to deepen your understanding and improve your implementation skills."}}]}`}
  </script>
</head>

To add images you can do one of four things:

<AccordionGroup>
  <Accordion title="Upload the image to the prompt chat">
    Simply upload them in the chat and explain to Lovable’s Agent where and how you’d like them to appear in your project. For example:

    > Replace the logo in navbar with this image
  </Accordion>

  <Accordion title="Replace it on the visual editor">
    You can replace an existing image directly using the [visual editor](https://docs.lovable.dev/features/precision-edit#visual-edits) functionality:

    <Steps>
      <Step title="Step 1">
        Click on "Edit" tool.
      </Step>

      <Step title="Step 2">
        Select the image holder you would like to change.

        <img src="https://mintcdn.com/lovable-f9060f1e/luGRYj9iOP9EB2xE/images/visual-edit-replace.png?fit=max&auto=format&n=luGRYj9iOP9EB2xE&q=85&s=c3ef73f6ff41ea097d98877ad851b7b4" alt="Visual editor showing an image element selected with the edit panel open" width="1378" height="1190" data-path="images/visual-edit-replace.png" />
      </Step>

      <Step title="Step 3">
        Change the image.

        <img src="https://mintcdn.com/lovable-f9060f1e/luGRYj9iOP9EB2xE/images/visual-edit-image.png?fit=max&auto=format&n=luGRYj9iOP9EB2xE&q=85&s=933dfe0bbcd73ea410a7eeccc6b380ae" alt="Image replacement dialog in visual editor with upload and URL options" width="412" height="392" data-path="images/visual-edit-image.png" />
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Using an external image URL">
    One way to add images to your project is by referencing an image from an external URL. This method allows you to use images hosted on external platforms like Unsplash, Imgur, or any other image-hosting service. Be mindful of use copyrights!

    Here’s how to prompt Lovable to use an external image:

    <Steps>
      <Step title="Step 1">
        Find the image you want to use.

        For example, you can visit a site like Unsplash, select an image, and copy its URL.
      </Step>

      <Step title="Step 2">
        In your project prompt, simply tell Lovable to use that image by specifying the URL. For example:

        ```
        Use the image from this URL 
        https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Pale_Blue_Dot.png/442px-Pale_Blue_Dot.png 
        for the hero section image.
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Using images from your GitHub public directory">
    Another method to add images to your Lovable project is by using images uploaded to the `public` directory of your connected GitHub repository. Here’s how you can do it:

    <Steps>
      <Step title="Connect your GitHub repository">
        Ensure your project is connected to your GitHub repo. [Here's how to connect your repo](https://docs.lovable.dev/integrations/git-integration).
      </Step>

      <Step title="Locate the public folder">
        Inside your GitHub repository, navigate to the `public` directory. This folder is typically used for hosting assets like images that can be referenced in your project.
      </Step>

      <Step title="Add file">
        Click on **Add file** and then from a dropdown, select **Upload files** option. <img src="https://mintcdn.com/lovable-f9060f1e/5WiQj0NImuyTcvae/assets/using-images-github-upload.png?fit=max&auto=format&n=5WiQj0NImuyTcvae&q=85&s=6fade7ed311819f21d86cccc8301e20a" alt="Selecting files for upload" width="1339" height="453" data-path="assets/using-images-github-upload.png" />
      </Step>

      <Step title="Upload an image">
        The next step is to transfer your image to your repo:

        * Drag and drop the image into the public folder, or
        * Click on the **"choose your files"** link to browse and select the image file. <img src="https://mintcdn.com/lovable-f9060f1e/5WiQj0NImuyTcvae/assets/using-images-github-commiting.png?fit=max&auto=format&n=5WiQj0NImuyTcvae&q=85&s=20260b87c26626661ee3c9fa07ddeaa8" alt="Selecting files for upload" width="1339" height="826" data-path="assets/using-images-github-commiting.png" />
      </Step>

      <Step title="Commit the changes">
        After selecting your image, write a simple commit message (e.g., "Adding image files to be used in the app") and click **"Commit changes"** to save the file to your repo.
      </Step>

      <Step title="Get the image path">
        Once the file is uploaded, select it and then click on the copy icon next to the file name to copy the image’s path. This path will be used in your Lovable prompt. <img src="https://mintcdn.com/lovable-f9060f1e/5WiQj0NImuyTcvae/assets/using-images-github-selecting.png?fit=max&auto=format&n=5WiQj0NImuyTcvae&q=85&s=a79d146039307e9a5a332200fb289fa6" alt="Selecting files for upload" width="1339" height="825" data-path="assets/using-images-github-selecting.png" />
      </Step>

      <Step title="Use the image in Lovable">
        You can now reference this image in your project by using a prompt like the following:

        ```
        Add an additional image to the hero section. 
        This time, use this one from my local repo: public/c-64-close-up.jpg.jpeg
        ```

        Be sure to use your image name and path you copied in the previous step.

        <Warning>
          Uploading large images to your GitHub repo can cause it to grow in size, which can affect Lovable performance (longer repo cloning times, slower startup of previews/sandbox).

          Try to optimize your images before uploading them to your `public` folder by compressing them and using dimensions that are relevant to your use case. For example, don't use a full HD-sized image if it will only be displayed as a small icon.
        </Warning>
      </Step>
    </Steps>

    To help you better understand how to integrate images using the methods outlined above, we have a project you can explore: [Lovable Project Example](https://lovable.dev/projects/e823fedf-238d-4313-86a8-1fd4bfc2a9ba). In this project, you can see the actual prompts and how each method works in practice.

    Additionally, here's a public GitHub repository that includes the commits, uploaded images, and full implementation details. You can view the repository here: [GitHub: Adding Images Example](https://github.com/viborc/adding-images-example).

    Feel free to explore the project and repository to deepen your understanding and improve your implementation skills.
  </Accordion>
</AccordionGroup>
