-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pya.LayoutView.save_image() without pya.Application #1914
Comments
Hi Lukas, As for downloading and installing KLayout each time, I do that too, to run DRC & LVS Ruby scripts. It takes 20 seconds on GitHub runners, most of that time being downloading the KLayout deb. If someone could suggest a better approach for the environment and to reduce KLayout hosting costs, I'm all ears. |
This is possible already in the python standalone module. gdsfactory/kfactory use this to generate screenshots (also stuff like kweb use this for sending updates) Plotting code is here https://github.com/gdsfactory/kfactory/blob/main/src/kfactory/widgets/interactive.py#L63 But essentially it boils down to this:
|
Yes, correct. Actually, the reason why the Application object is required is QImage. For some reason it needs a QApplication object. Among other things, a PixelBuffer can be written png and also be converted to a PNG bytestream which makes it perfect for server-side image generation. The "kweb" module makes use of that feature to implement a browser-based interface (https://pypi.org/project/kweb/). All of that does not need an Application object. Regarding @srooks10's question if there is a more lightweight alternative: you can build KLayout without Qt (use In my case (Ubuntu 24), this build creates binaries that bundle into a tar.gz of 17MB, compared to 61MB deb in the full version, not counting the Qt libraries which probably also need to be installed. Matthias |
@sebastian-goeldi was quicker than me - he answered while I was still typing :) |
But I did a build to check the binaries' size too :) |
Hi Matthias,
I would like to create an image of a layout, without relying on pya.Application.
Presently it requires the application (which can be headless) and LayoutView: https://www.klayout.de/doc-qt5/code/class_LayoutView.html#method208
My use case is generating an image in a Python script, automated in GitHub actions. Potentially I could download and install KLayout each time, but that would not be very efficient.
Thank you
Lukas
The text was updated successfully, but these errors were encountered: