Skip to content

Generate high-res output for retina/high-dpi screens #58

@jemory

Description

@jemory

Images generated by quotable and factlist are 640x640px or 640x360px*. This resolution is not adequate to guarantee sharp text in all views on computers with high-dpi displays.

Going by Apple's standard for Retina assests, we should double the size of the output images. I've been working on solving this issue.

My solution has been to simply double the size of the .poster element (and all associated measurements). The downside to this is, obviously, that the preview is now unreasonably large (at least 1280x720px). At first, I attempted to use transform: scale(0.5) on .poster but html2canvas does not support transforms, so the output was garbled. I have achieved success so far by using zoom: 0.5; instead. The result is a 640x360 preview and 1280x720 output.

Samples

Original

quote-hey-nerds-whos-got-two

High-resolution

### Issues - The `zoom` property is not supported in Firefox, so Firefox will display the preview un-scaled. - The document size needs to be greater than 1280x1280, otherwise html2canvas will crop the output like so:


This does result in scrollbars in the electron app. Perhaps this could be improved with some `overflow` settings.

I've implemented this for Quotable in the Retina branch of my fork of this repo. I would like to request feedback on the approach and well as thoughts on Firefox compatibility. I've also only tested this so far in Chrome-latest and electron on Mac OS.

*Side note, from my research, it appears that the twitter preview aspect ratio is closer to 2:1 than 16:9, but that's a separate question.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions