Images
Last modified: 11 February 2024IntelliJ IDEA offers several ways to view images. You can use navigation to source or open an image in an external graphical editor.
IntelliJ IDEA supports all popular image formats, such as PGN, JPG, and GIF. You can find a full list of supported file types in Settings (): go to Editor | File Types and locate Image on the list. Learn more about file types in IntelliJ IDEA from File type associations.
View images in IntelliJ IDEA
In the Project tool window ( View | Tool Windows | Project) , find and select the image file.
Alternatively, place the caret at the reference to the image in the editor and press .
To preview an image in a popup instead of in a separate tab, select the reference to it and press .
View images in an external editor
In the Project tool window ( View | Tool Windows | Project) , right-click the image file and select Jump to external editor.
Alternatively, press .
IntelliJ IDEA opens the image in the editor that is used in your OS by default. You can configure another image editor in which the IDE will open files.
Change the default external editor
Right-click an image in the editor and select Edit Path to External Editor from the context menu.
You can also press and type
Edit Path to External Editor
.In the Path to External Editor dialog, specify the path to the application in which you want to open images and click Save.
Example: Import an image
Images belong to resource files. They should be stored in a dedicated folder – Resources Root. If you do not have this folder in your project, create a new directory, right-click it in the Project tool window, and select Mark Directory as | Resources Root.
Copy the file in the file manager and then paste in to the folder with resource files in the IDE Project tool window.
In the dialog that opens, edit the filename and the target location if necessary. Click OK.
Right-click the pasted image in the Project tool window and select Copy | Path From Source Root.
In the class in which you want to use the image, place the caret at the necessary line and press to paste the path to the image.
Run the class to make sure that the image is inserted correctly.