Image Generation
by SherifEldeeb
|
Skill Details
Repository Files
7 files in this skill directory
name: image-generation description: | Create diagrams, charts, and visual assets for security documentation. Generate network diagrams, architecture visuals, and data visualizations. Use when creating visual content for reports or presentations. license: Apache-2.0 compatibility: |
- Python 3.9+
- Required packages: pillow, matplotlib, graphviz metadata: author: SherifEldeeb version: "1.0.0" category: baseline
Image Generation Skill
Create diagrams, charts, and visual assets for security documentation with support for network diagrams, data visualizations, and flowcharts.
Capabilities
- Diagrams: Generate network topology and architecture diagrams
- Charts: Create data visualizations (bar, pie, line, heatmaps)
- Flowcharts: Build process and workflow diagrams
- Risk Matrices: Generate risk assessment visualizations
- Timelines: Create incident and event timelines
- Export: Save to PNG, SVG, and PDF formats
Quick Start
import matplotlib.pyplot as plt
# Create a simple bar chart
severities = ['Critical', 'High', 'Medium', 'Low']
counts = [3, 8, 15, 22]
plt.figure(figsize=(10, 6))
plt.bar(severities, counts, color=['#e74c3c', '#e67e22', '#f1c40f', '#3498db'])
plt.title('Findings by Severity')
plt.savefig('severity_chart.png', dpi=150)
Usage
Bar Charts
Create bar charts for comparisons.
Example:
import matplotlib.pyplot as plt
from typing import Dict
def create_severity_chart(data: Dict[str, int], output_path: str = 'chart.png'):
"""Create a severity distribution bar chart."""
colors = {
'Critical': '#e74c3c', 'High': '#e67e22',
'Medium': '#f1c40f', 'Low': '#3498db'
}
severities = list(data.keys())
counts = list(data.values())
bar_colors = [colors.get(s, '#333') for s in severities]
plt.figure(figsize=(10, 6))
plt.bar(severities, counts, color=bar_colors)
plt.title('Findings by Severity', fontsize=14, fontweight='bold')
plt.savefig(output_path, dpi=150, bbox_inches='tight')
plt.close()
# Usage
create_severity_chart({'Critical': 3, 'High': 8, 'Medium': 15, 'Low': 22})
Network Diagrams
Create network topology diagrams using Graphviz.
Example:
from graphviz import Digraph
def create_network_diagram(nodes: list, edges: list, output_path: str = 'network'):
"""Create a network topology diagram."""
dot = Digraph()
dot.attr(rankdir='TB')
shapes = {'firewall': 'box3d', 'server': 'box', 'database': 'cylinder'}
for node in nodes:
dot.node(node['id'], node['label'],
shape=shapes.get(node.get('type', 'server'), 'box'),
style='filled', fillcolor=node.get('color', 'lightblue'))
for edge in edges:
dot.edge(edge['from'], edge['to'], label=edge.get('label', ''))
dot.render(output_path, format='png', cleanup=True)
# Usage
nodes = [
{'id': 'fw', 'label': 'Firewall', 'type': 'firewall', 'color': 'lightcoral'},
{'id': 'web', 'label': 'Web Server', 'type': 'server'},
{'id': 'db', 'label': 'Database', 'type': 'database'}
]
edges = [{'from': 'fw', 'to': 'web'}, {'from': 'web', 'to': 'db'}]
create_network_diagram(nodes, edges)
Flowcharts
Create process flowcharts.
Example:
from graphviz import Digraph
def create_flowchart(steps: list, output_path: str = 'flowchart'):
"""Create a process flowchart."""
dot = Digraph()
dot.attr(rankdir='TB')
shapes = {'start': 'ellipse', 'end': 'ellipse',
'process': 'box', 'decision': 'diamond'}
colors = {'start': 'lightgreen', 'end': 'lightcoral',
'process': 'lightblue', 'decision': 'lightyellow'}
for step in steps:
dot.node(step['id'], step['label'],
shape=shapes.get(step.get('type', 'process'), 'box'),
style='filled',
fillcolor=colors.get(step.get('type', 'process'), 'white'))
if 'next' in step:
for n in (step['next'] if isinstance(step['next'], list) else [step['next']]):
if isinstance(n, dict):
dot.edge(step['id'], n['to'], label=n.get('label', ''))
else:
dot.edge(step['id'], n)
dot.render(output_path, format='png', cleanup=True)
Risk Heatmaps
Create risk assessment heatmaps.
Example:
import matplotlib.pyplot as plt
import numpy as np
def create_risk_heatmap(data: list, x_labels: list, y_labels: list, output_path: str):
"""Create a risk assessment heatmap."""
fig, ax = plt.subplots(figsize=(10, 8))
im = ax.imshow(data, cmap='RdYlGn_r')
ax.set_xticks(np.arange(len(x_labels)))
ax.set_yticks(np.arange(len(y_labels)))
ax.set_xticklabels(x_labels)
ax.set_yticklabels(y_labels)
for i in range(len(y_labels)):
for j in range(len(x_labels)):
ax.text(j, i, data[i][j], ha='center', va='center',
color='white' if data[i][j] > 5 else 'black')
ax.set_title('Risk Matrix')
plt.colorbar(im)
plt.savefig(output_path, dpi=150)
plt.close()
Configuration
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
IMAGE_OUTPUT_DIR |
Output directory | No | ./output |
IMAGE_DPI |
Default DPI | No | 150 |
Limitations
- Interactive: Static images only
- 3D: Limited 3D support
- Graphviz: Required for diagrams
Troubleshooting
Graphviz Not Found
Install the system package:
apt-get install graphviz # Ubuntu
brew install graphviz # macOS
Related Skills
References
Related Skills
Attack Tree Construction
Build comprehensive attack trees to visualize threat paths. Use when mapping attack scenarios, identifying defense gaps, or communicating security risks to stakeholders.
Grafana Dashboards
Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces.
Matplotlib
Foundational plotting library. Create line plots, scatter, bar, histograms, heatmaps, 3D, subplots, export PNG/PDF/SVG, for scientific visualization and publication figures.
Scientific Visualization
Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.
Seaborn
Statistical visualization. Scatter, box, violin, heatmaps, pair plots, regression, correlation matrices, KDE, faceted plots, for exploratory analysis and publication figures.
Shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Query Writing
For writing and executing SQL queries - from simple single-table queries to complex multi-table JOINs and aggregations
Pydeseq2
Differential gene expression analysis (Python DESeq2). Identify DE genes from bulk RNA-seq counts, Wald tests, FDR correction, volcano/MA plots, for RNA-seq analysis.
Scientific Visualization
Meta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly with publication styles. For quick exploration use seaborn or plotly directly.
