How to | Import and Export Images
Of the many ways images can be loaded into a Wolfram System notebook, Import is the main method used to access image files on your local computer or at a remote location. The import and export of images are the most common first and last steps of practically any image processing computation.
Use the Insert ▶ File Path menu item or type a file path to import a local image file as an image object.
This example imports an image from the Wolfram Language documentation directory ExampleData:
The Wolfram Language provides a general mechanism for naming and finding files that works on all systems.
Use FileNameJoin to construct a complete path to a file on the local system:
By specifying the elements of an image for Import, you can get useful information before loading it into the kernel. The file type is automatically deduced from the file name extension:
Once you have imported the image, you can modify and analyze it. As a simple example, consider how the image changes appearance under different permutations of its color channels.
Permute the channels in six different ways and form color images from each:
You can now save the six different images in your local file system by exporting them in any of the many supported file formats. In this example, the JPEG format is used because it stores efficiently.
You can export to an existing directory or create a new directory from within the Wolfram Language. Here, CreateDirectory is used to create a directory in the local system's temporary storage area:
Use FileNameJoin to construct a file name using a simple indexing scheme:
Use Table with Export to iterate the naming of the files based on the indexing scheme:
Import one of the saved images to verify the save operation: