transparency-generation — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited transparency-generation (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Generate AI images with high-quality alpha channels (transparency) using the difference matting technique. This method captures semi-transparent elements (hair, glass, smoke) that simple background removal cannot.
Given white background image (W) and black background image (B):
A = 1 - (W - B)C = B / A (where A > 0)This captures partial transparency that single-background methods miss.
prompt = "YOUR_PROMPT_HERE"
seed = 12345 # CRITICAL: Use same seed for both
white_config = {
"prompt": f"{prompt}, white background, studio lighting",
"seed": seed,
"sampleCount": 1,
"addWatermark": False, # Required for determinism
"aspectRatio": "1:1",
"model": "gemini-3-pro-image-preview" # Lock exact version
}black_config = {
"prompt": f"{prompt}, black background, studio lighting",
"seed": seed, # SAME seed
"sampleCount": 1,
"addWatermark": False,
"aspectRatio": "1:1",
"model": "gemini-3-pro-image-preview" # SAME model version
}from skimage.metrics import structural_similarity as ssim
import cv2
def validate_similarity(white_path, black_path, threshold=0.85):
"""Ensure images are same scene (seed worked correctly)"""
white = cv2.imread(white_path, cv2.IMREAD_GRAYSCALE)
black = cv2.imread(black_path, cv2.IMREAD_GRAYSCALE)
score = ssim(white, black)
if score < threshold:
raise ValueError(
f"Images too different (SSIM={score:.3f}). "
f"Seed may not be deterministic. Regenerate with locked parameters."
)
return scoreimport numpy as np
import cv2
def extract_alpha_difference_matting(white_path, black_path,
blur_kernel=3, threshold=0.01):
"""
Extract alpha using difference matting.
Args:
white_path: Path to white background image
black_path: Path to black background image
blur_kernel: Median blur kernel size (reduces noise)
threshold: Minimum alpha value (removes artifacts)
Returns:
rgba_image: RGBA image with extracted alpha
alpha_channel: Alpha channel for inspection
"""
# Load as float32 for precision
white = cv2.imread(white_path, cv2.IMREAD_COLOR).astype(np.float32) / 255.0
black = cv2.imread(black_path, cv2.IMREAD_COLOR).astype(np.float32) / 255.0
# Validate same dimensions
if white.shape != black.shape:
raise ValueError(f"Size mismatch: {white.shape} vs {black.shape}")
# Extract alpha: A = 1 - (W - B)
# Average across color channels for robustness
diff = white - black
alpha = 1.0 - np.mean(diff, axis=2)
# Clamp to valid range [0, 1]
alpha = np.clip(alpha, 0.0, 1.0)
# Remove noise below threshold
alpha[alpha < threshold] = 0.0
# Smooth alpha channel (reduces artifacts)
if blur_kernel > 0:
alpha_uint8 = (alpha * 255).astype(np.uint8)
alpha_smooth = cv2.medianBlur(alpha_uint8, blur_kernel)
alpha = alpha_smooth.astype(np.float32) / 255.0
# Reconstruct original color: C = B / A
# Avoid division by zero
color = np.zeros_like(black)
mask = alpha > 0.01
for c in range(3):
color[:,:,c] = np.where(
mask,
black[:,:,c] / np.maximum(alpha, 0.01),
0
)
color = np.clip(color, 0.0, 1.0)
# Combine into RGBA
rgba = np.dstack((color, alpha))
rgba_uint8 = (rgba * 255).astype(np.uint8)
alpha_uint8 = (alpha * 255).astype(np.uint8)
return rgba_uint8, alpha_uint8from PIL import Image
# Save with PIL to ensure proper PNG alpha
rgba_pil = Image.fromarray(rgba_image, mode='RGBA')
rgba_pil.save("output_transparent.png", "PNG")
# Save alpha channel for inspection
cv2.imwrite("output_alpha.png", alpha_channel)To ensure white and black images are identical:
addWatermark: false (watermarks break determinism)blur_kernel parameterBefore accepting results:
| Problem | Cause | Solution |
|---|---|---|
| Images look completely different | Seed not deterministic | Lock all parameters, set addWatermark: false |
| Noisy alpha channel | Pixel-level variation | Increase blur_kernel to 5 or 7 |
| Color fringing on edges | Background not pure white/black | Verify background RGB values |
| Black/white objects disappear | Fundamental limitation | Add rim lighting or colored backgrounds |
| Similarity check fails | Model version changed | Lock model to exact version string |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.