blob: 9f68f15e86d9d7ee630d4f8dd36c6b50e047ca3d [file] [log] [blame]
Greg Davillc72fc442022-12-04 18:56:30 +10301# SPDX-FileCopyrightText: 2022 Greg Davill
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# SPDX-License-Identifier: Apache-2.0
16
17lv = pya.LayoutView.current()
18ly = pya.CellView.active().layout()
19
20# top cell bounding box in micrometer units
21bbox = ly.top_cell().dbbox()
22
23# compute an image size having the same aspect ratio than
24# the bounding box
25w = 1200
26h = int(0.5 + w * bbox.height() / bbox.width())
27
28lv.save_image_with_options('layout.png', w, h, 0, 0, 0, bbox, False)