Skip to main content
Nidhin_Kuttikkattu_Rajeevan
Active Member
January 16, 2023
Question

Exporting a particular image

Hi

I wish to export a particular layer from my figma file. I refer this link.
https://www.figma.com/developers/api#get-file-nodes-endpoint
But when I try to run the cURL command, I am getting the entire screen. For example, if the screen size is 1920x1080, and if I try to export an image of size 100x100, it is still returning an image URL of 1920x1080

curl -H ‘X-FIGMA-TOKEN: myAccesstoken’ ‘https://api.figma.com/v1/images/myFileID?ids=**525%3A4832&t=jDeGTNemBZ14AaSq-0**&format=png’

Basically can we give a particular layer item instead of 525%3A4832&t=jDeGTNemBZ14AaSq-0? When I change different layer items, 525%3A4832&t=jDeGTNemBZ14AaSq-0 is not changing in the URL. it is the nodeId

This topic has been closed for replies.

13 replies

Nidhin_Kuttikkattu_Rajeevan
Active Member
January 17, 2023

Yeah, just for this purpose, I learned how to write plugins for figma. Started with the youtube tutorials, and tried to run some github based examples. I know how to iterate through the document, hide layers show layers etc. 😊

You can export nodes as images via plugins API.

This is what exactly I am trying.

Gleb
Power Member
January 17, 2023

node.exportAsync exportAsync | Plugin API will get you the image data. But I don’t know how to save it to the computer, I haven’t done that myself yet. Try finding some examples on github. Sorry I can’t help any further.

Nidhin_Kuttikkattu_Rajeevan
Active Member
January 17, 2023

Sure, I will try and update the ticket if I make it to support other viewers