Convert logo to GDS
How to convert an image to a GDS format
import nazca as nd nd.image('image.jpg').put() nd.export_gds()
In this example we show how to convert an image to a GDS format. The image can be your logo that you later on place in your design. Image formats include png, jpg, gif, bpm, eps and others.
There is a set of parameters that can be used to customize the image conversion. For example, by changing the threshold value (default is 0.5) you can set the threshold for the light and dark areas of the image. Consider the comparison below:
import nazca as nd nd.image('image.jpg', threshold=0.3).put(0) nd.image('image.jpg', threshold=0.6).put(200) nd.export_gds()
You can invert the image by setting invert flag to True.
import nazca as nd nd.image('image.jpg', threshold=0.4).put(0) nd.image('image.jpg', threshold=0.4, invert=True).put(200) nd.export_gds()
The layer to which the image is exported can be customized by providing a layer number. A rectangular box can be added around the logo/image by providing a box_layer, e.g. for tiling exclusion areas. To view this GDS file in KLayout we recommend to use demofab_klayout_colors.lyp.
import nazca as nd nd.image('image.jpg', threshold=0.4, layer=1, box_layer=10).put(0) nd.image('image.jpg', threshold=0.4, invert=True, layer=5, box_layer=3).put(200) nd.export_gds()
Moreover the image size and the pixel size can be set as needed.
import nazca as nd nd.image('image.jpg', threshold=0.4).put(0) nd.image('image.jpg', threshold=0.4, size=100, pixelsize=5).put(200) nd.export_gds()
We used a photograph of Albert Einstein from Wiki: download it from here.