Convert GDS to 1 Bit TIFF

Is it possible to convert the GDS layout to 1 Bit TIFF with a 1um resolution. Almost like a raster form that can trace the design into pixels of a single layer.
Any help or guidance will be great.
Thanks.
Nakul

Comments

  • This one-liner script saves a 0,0 .. 200,150 µm box to a monochrome PNG file with 200 pixels width and 150 pixels height - hence 1µm resolution:

    RBA::LayoutView::current.save_image_with_options("path/to/file.png", 200, 150, 0, 0, 0, RBA::DBox::new(0.0, 0.0, 200.0, 150.0), true)
    

    You can convert PNG to TIFF using one of the many image conversion tools (e.g. ImageMagick).

    For more details about the "save_image_with_options" see here: https://www.klayout.de/doc-qt5/code/class_LayoutView.html#k_192

    Matthias

  • Thank you very much Matthias. Thanks for your quick response.
    I shall look into this. I take it we can have a dialogue to ask the user to enter the file dimensions or a way to pick out the maximum layout dimensions. Will investigate it further.
    Will there be an option in the future to extend the image file types.
    Thanks.
    Nakul

  • Hi Matthias,
    I tried the script, but it outputs a blank file. When I used save_image with the same parameters then I could see the image save in PNG format. Not sure what I was doing wrong. The save_image seems to be limited to 6400x6400 pixels, which doesn't capture the details I need in the layout.

    I was also going through the past forums to see if this has been done before and found the following:
    https://www.klayout.de/forum/discussion/476/is-there-any-api-supporting-generating-bitmap-out-of-gds/p1

    However the page links in that thread were not working.

    I have a GDS file with the dimensions of 50000x50000um with a <1um precision. This GDS layout I am trying to convert to TIFF which is readable for mask making.

    Can you please guide me as to what I need to be doing to get the desired output from my Layout.

    Thanking you in anticipation.

    Kind regards,
    Nakul

  • The script line worked for me. Please make sure you are adjusting the box coordinates accordingly.

    The PNG writer is a system-supplied one. I can't overcome it's limitations.

    The forum links have change slightly. The discussion #167 link is: https://www.klayout.de/forum/discussion/167

    But when you want to write masks, you should not use screenshot images. They are subject to optimization and accuracy is never better than +/- one pixel. A rasterizer is a different piece of software.

    Matthias

  • I have a GDS file with the dimensions of 50000x50000um with a <1um precision

    That looks to me like 2.5Gb (at 1 bit per pixel),
    which is kind of chubby for an image file. It might
    be overflowing some limit in a png->tiff conversion
    script?

    That's one way to get a null .tif file I reckon - just
    give up for filesize (or allocated VM space).

    Are you sure that the mask shop can't handle the
    .png format? Supposed to be lossless, so why not?

  • Thanks Matthias and Freebird,
    The mask shop was specific in saying that we need to supply 1Bit TIFF. They need to use external vendors or interface to convert from actually a DXF/DWG to TIFF.
    They are aware of the size, just making life difficult for us.
    For the rasterizer would you have any recommendations that work with KLayout.
    Thanks,
    Nakul

  • @Nakulh My general concen is a quality one, because the images are intended for display. So one pixel more or less is not much of a concern on a screen while it is on a mask. Pixels may also be shifted. Drawing speed is more important for screen display than quality, so the algorithm may compromise quality for speed.

    A quality rasterizer should make some warranties about quality. I don't have a recommendation here - the mask makers I worked with all accepted polygon formats. KLayout has some code for quality rasterization of polygons (used for example in the fill tool), but that is not available as a user feature and will be a way slower. It computes the coverage percentage per pixel and you can choose to turn a pixel on for more than 50% coverage for example.

    BTW: on Linux (Ubuntu 20.04LTS in my case), the conversion works flawlessly for 50000x50000 monochrome PNG. It's a matter of capabilities of libpng built into Qt. Memory peaks to a few GB during that process, but that's all.

    Matthias

  • Thanks Matthias,
    That sounds like a promising solution. If you can point me to that code, I shall investigate it further.
    Many Thanks.
    Nakul

  • What do you mean? Using Linux with a better libpng?

    Or do you mean the rasterizer. If you're familiar with C++ you can take a look here: https://github.com/KLayout/klayout/blob/master/src/db/db/dbPolygonTools.h (function "rasterize"). But that API isn't open (means: no warranties) and you'll still need to know how to merge (remove overlaps) a layout and turn it into a sequence of polygons. Plus how to code a loop and a bitmap collector for turning the per-polygon area map into pixels in a large bitmap. And finally you'll still need a TIFF writer capable of handling large bitmaps.

    Matthias

  • Thanks Matthias,

    Highly appreciated. It was the rasterizer I was after and shall certainly try this uphill task. Thanks for sharing the link, you are truly knowledgeable.

    Cheers,
    Nakul

Sign In or Register to comment.