Skip to content

Commit de51f21

Browse files
committed
add createPngUrl
1 parent 4cc87b7 commit de51f21

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ export function createSvgUrl(
3333
return `https://svg.tscircuit.com/?svg_type=${svgType}&code=${encodeURIComponent(base64Data)}`
3434
}
3535

36+
export function createPngUrl(
37+
tscircuitCode: string,
38+
view: "pcb" | "schematic" | "3d",
39+
) {
40+
const base64Data = getCompressedBase64SnippetString(tscircuitCode)
41+
return `https://png.tscircuit.com/?view=${view}&code=${encodeURIComponent(base64Data)}`
42+
}
43+
3644
export function createSnippetUrl(text: string, snippet_type?: string): string {
3745
// Construct the URL
3846
const typeParam = snippet_type ? `&snippet_type=${snippet_type}` : ""

0 commit comments

Comments
 (0)