skppy.data_structure.images¶
Image texture data class.
Textures are image files referenced by materials. The raw image data can be extracted from the ZIP archive.
Example
tex = Texture(filename="brick_wall.png", x_scale=100.0, y_scale=100.0)
if tex.data:
with open(tex.filename, "wb") as f:
f.write(tex.data)
- class skppy.data_structure.images.Texture[source]
Bases:
objectAn image texture referenced by a Material.
- Parameters:
filename (str) – Original filename as stored in the .skp (e.g.,
"brick.jpg").x_scale (float, optional) – Width of one texture tile in inches. Default 1.0.
y_scale (float, optional) – Height of one texture tile in inches. Default 1.0.
data (bytes or None, optional) – Raw image bytes (JPEG, PNG, etc.).
Noneif not extracted.
Examples
>>> tex = Texture(filename="brick.jpg", x_scale=100.0, y_scale=50.0) >>> tex.filename 'brick.jpg' >>> tex.x_scale 100.0
- __init__(filename: str = '', x_scale: float = 1.0, y_scale: float = 1.0, data: bytes | None = None) None
- skppy.data_structure.images.normalize_texture_scale(value: float, default: float = 1.0) float[source]
Return a finite, non-zero texture scale suitable for UV division.
Negative scales are retained because they can intentionally mirror a texture. Zero, near-zero, NaN, and infinite values cannot define a physical tile size and fall back to one SketchUp inch.