Merge pull request #445 from berniexie/increase-png-export-quality

increase png export quality
This commit is contained in:
Alexander Wang 2022-12-18 20:36:15 -08:00 committed by GitHub
commit c497c82189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -145,7 +145,7 @@ one, please see [./d2renderers/d2fonts](./d2renderers/d2fonts).
## Export file types
D2 currently supports SVG exports. More coming soon.
D2 currently supports SVG and PNG exports. More coming soon.
## Language tooling
@ -209,6 +209,7 @@ let us know and we'll be happy to include it here!
- **Emacs extension**: [https://github.com/andorsk/d2-mode](https://github.com/andorsk/d2-mode)
- **Telegram bot**: [https://github.com/meinside/telegram-d2-bot](https://github.com/meinside/telegram-d2-bot)
- **Postgres importer**: [https://github.com/zekenie/d2-erd-from-postgres](https://github.com/zekenie/d2-erd-from-postgres)
- **Structurizr to D2 exporter**: [https://github.com/goto1134/structurizr-d2-exporter](https://github.com/goto1134/structurizr-d2-exporter)
### Misc

View file

@ -9,6 +9,7 @@
- `d2 fmt` now preserves leading comment spacing. [#400](https://github.com/terrastruct/d2/issues/400)
- Markdown can now be styled with keywords stroke and fill. [https://github.com/terrastruct/d2/pull/460](https://github.com/terrastruct/d2/pull/460)
- PNG export resolution increased by 2x to not be blurry exporting on retina displays. [https://github.com/terrastruct/d2/pull/445](https://github.com/terrastruct/d2/pull/445)
#### Bugfixes ⛑️

View file

@ -11,8 +11,8 @@ async (imgString) => {
};
const img = await loadImage();
const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
canvas.width = img.width * 2;
canvas.height = img.height * 2;
const ctx = canvas.getContext("2d");
if (!ctx) {
return new Error("could not get canvas context");