How to extract your original images from your Sketch files
If you’ve ever been in a situation where you’d like to access the original image of a background or override, then you’re like me and probably realized that there is no way to do it within Sketch. After giving up on trying to do this from within their UI, I finally decided to dig deeper and see if I can extract it from the Sketch file itself somehow, as it must be stored there.
The first question I asked myself is, what is a Sketch file? My first intuition was to drop the sketch file in a text editor and see if there was anything relevant in there:
While most of it is not readable, you can tell that there are specific file formats such as .json, specifically I noticed document.json. My next step was to search for anything that could be related to images, so after searching for “images” I found an interesting file path:
So this tells me that the file is probably zipped and there are folders within it. So I tried changing my file’s extension from .sketch to .zip:
After double clicking so it unzips, to my pleasant surprises all the images were nicely placed in the image folder we noticed earlier:
And inside of my folder, lies the original image I was looking for in the override, along with all the images of the sketch file!
That was much easier than I expected and saved me a lot of trouble.