Paper Size Presets
See original GitHub issueSomething I hate doing is googling for common sizes and converting to/from various units, so I think it could be handy to have a simple way of starting from a ‘preset’.
const canvasSketch = require('canvas-sketch');
const settings = {
...canvasSketch.preset('A4')
};
Which leads to { units: 'cm', dimensions: [ 21, 29.7 ] }.
Could support:
- A1-8, B, C, D…
- letter
- legal
- tabloid
- postcard (4x6")
- business-card
- poster (18x24" according to Photoshop and this random site)
The object can be merged in with your settings using ... or Object.assign({}), and/or the function could also accept other values and merge them into the result:
const settings = canvasSketch.preset('a4', {
animate: true, // a looping print
units: 'in', // if you want to work in inches
});
If you pass in units it will do the conversion for you, so you can work in your preferred unit.
Could also support some web defaults like:
- 1080p, 720p, 480p, 320p, 240p
Which returns { units: 'px', dimensions: [ x, y ] }.
Questions:
- Is this too much scope creep? I don’t think so since the tool is aiming to be an all-around convenience for generative art and this seems like a common task.
- Is the above syntax clean/easy or is there another way the function should be imported and used?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Choose a paper size for your printed document on Mac
On your Mac, choose the paper size to use when printing. ... On your Mac, choose Apple menu > System Settings, then click...
Read more >Paper Sizes and Formats, the Difference Between A4 and Letter
Paper sizes and formats explained: learn more about the difference ... These presets typically take the form of buttons labelled A3→A4 and so...
Read more >Printer Is Configured to Use the Wrong Paper Size
Click Start, point to Settings, and the click Printers. · Right-click the appropriate printer, and then click Properties. · Click the Paper tab,...
Read more >Paper Size and Type Settings
If displayed paper size and type differ from the loaded paper, select the item to change. If the settings match the loaded paper,...
Read more >Presets - Standard Print Sizes - Lightroom Killer Tips
It would be helpful if Lightroom had an option to forego the printer settings and let you choose options like paper size and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I decided to go with
{ dimensions: 'A4' }since it’s simple for the end user. Also relevant now isorientation–Added to docs:
Developing with Physical Units — Paper Size Presets
If I understand correctly, yes, that makes sense!