This tool extracts image relationships from PixPlot visualizations and exports them as CSV files that can be imported into Gephi for network analysis of visual influence patterns.
- Extracts nearest-neighbor relationships between images based on the UMAP layout
- Creates a network dataset with weighted edges between visually similar images
- Includes metadata from the original PixPlot visualization
- Generates both nodes and edges CSV files for direct import into Gephi
1000 images from Oslo, coloured by modularity, sized by eigenvector centrality
Inspired by the work of Arnold & Tilton
- Get the script:
pixplot_network_export.py
- Requirements:
- Python 3.6+
- NumPy
- SciPy
Install requirements:
pip install numpy scipyUse pixplot on your folder of files. Then:
python pixplot_network_export.py --data_dir path/to/pixplot/output --n_neighbors 10 --output network.csv --include_thumbs --include_metadata--data_dir: Directory containing PixPlot output (with manifest.json, imagelists, thumbs, etc.)--n_neighbors: Number of nearest neighbors to find for each image (default: 10)--output: Output CSV file path for the edges file (default: pixplot_network.csv)--layout: Layout to use for finding neighbors (default: umap)--include_thumbs: Include thumbnail paths in output--include_metadata: Include all available metadata in output
-
Start Gephi and create a new project
-
Import the nodes file:
- In Gephi, go to Data Laboratory > Import Spreadsheet
- Select the
_nodes.csvfile - Choose "Nodes table" as the import type
- Configure the import settings as needed
-
Import the edges file:
- In Gephi, go to Data Laboratory > Import Spreadsheet
- Select the main CSV file created by the script
- Choose "Edges table" as the import type
- Make sure "Append to existing workspace" is selected
- Select "source" and "target" as the source and target columns
- Select "weight" as the weight column
-
Visualize the network:
- Go to Overview
- Apply a layout algorithm (ForceAtlas2 works well)
- Adjust node size based on degree or other metrics
- Adjust edge thickness based on weight
The script creates two CSV files:
-
Edges file (
network.csv): Contains information about relationships between images with columns:source: The source image filenametarget: The target image filename (neighbor)weight: The strength of the relationship (inverse of distance)distance: The distance between images in the layoutrank: The neighbor rank (1 = closest neighbor)- Position data for visualization
- Metadata from the source image (if available)
-
Nodes file (
network_nodes.csv): Contains information about each unique image with columns:id: The image filenamex,y: Coordinates in the layout- Metadata from the image (if available)
- If the script can't find layout files, try different
--layoutoptions (umap, tsne, rasterfairy) - If you have issues with file paths, check the structure of your PixPlot output directory
MIT License
