You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need option to have extra margin for generated image. #1556
I've had to edit exported images before sharing them with coworkers. The default minimum padding on exported images make them feel cramped. I would be happy even with a slightly more generous default padding.
@kcaran@dai-shi still --- what app/website/environment would benefit from more padding? Can you describe a case where it feels too cramped? Usually, when you display an image somewhere, there's a padding added by the website/app itself on top of the image.
This is controversial and I don't have a strong opinion to break backward compatibility. All I can say is that I feel so. My use case is to copy png to the clipboard and paste it in Slack. Here's the result.
I don't think you can assume that the underlying application will add an appropriate padding. For example, Outlook has a black background for displaying images. This is an example of an image I needed to post-process.
For the default, I'd rather have it be more generous because cropping is a much simpler post-processing edit than expanding the background.
I would really like some padding options, I had to wrap my entire drawing in a box unnecessarily so that the image would not feel cramped when sharing. In particular when sharing an image directly with someone and it's viewed in some lightbox the padding is necessary for content around the edges to look decent
@kyldvs Do you need to change the padding size occasionally in your use cases, or just increasing works for most of your cases? Do you have a specific number in that case?
This sounds like a reasonable change to increase the default padding. @kyldvs do you want to play with the padding and send a PR to what you feel is right?
I think the problem with a static size is that I drew a relatively large diagram, so when I send it and it is viewed in a lightbox it gets scaled down which makes the margins seem smaller. If I were to pick a fixed size appropriate for this large diagram I suspect it would be too large for smaller diagrams.
I think I would prefer it to be either a 3-state small/medium/large padding, or set a default but allow people to write in a custom padding.
It looks like I picked a margin of ~80px for my large diagram, when it is scaled down to the size of my screen it is ~16px.
An approach may be to have a default margin of some size (8px?) and then as the exported image grows increase (probably in increments of 4) up to a certain cap (64px? 128px?)
I'll repost my sentiment from the PR: I think the case for adaptive padding isn't a good fit when embedding images in blog posts and similar (Medium, Twitter etc.). It'll make the image smaller to fit on screen/tweet, and thus harder to read bigger diagrams.
We should think about what's the most common case for PNG exporting, and tailor to that case first.
I'm reviving this issue because I've a similar need, but the other way around: the fact that I find padding around my exported object is an issue for me.
I think that a controllable padding would be very useful (in my case: I need a 0 value)
Would love to see an option to control the padding around the exported image. Have to do all kinds of image manipulation stuff that I'm not good at to get the correct padding right now. Thanks!
I know this is closed but the workaround that @kyldvs mentioned to the padding issue works well for me. I add an invisible rectangle around the image that frames it. The export includes the frame and the space between it and the actual image. I wrote a blog post which hopefully includes more detail: https://www.kcaran.com/posts/excalidraw-add-padding-around-exported-image.html
Activity
dwelle commentedon May 8, 2020
We used to have an input where you could set custom padding, but removed it for simplicity's sake. What's your use case?
kcaran commentedon May 8, 2020
I've had to edit exported images before sharing them with coworkers. The default minimum padding on exported images make them feel cramped. I would be happy even with a slightly more generous default padding.
dai-shi commentedon May 8, 2020
I actually agree with this.
BTW, here's a workaround: https://excalidraw.com/#json=5685599130353664,NZWUVKsyFW3j9ysVutRtTA
dwelle commentedon May 8, 2020
@kcaran @dai-shi still --- what app/website/environment would benefit from more padding? Can you describe a case where it feels too cramped? Usually, when you display an image somewhere, there's a padding added by the website/app itself on top of the image.
dai-shi commentedon May 8, 2020
This is controversial and I don't have a strong opinion to break backward compatibility. All I can say is that I feel so. My use case is to copy png to the clipboard and paste it in Slack. Here's the result.
The same with Twitter: https://twitter.com/dai_shi/status/1256522186967248896
I personally like the simplicity, so I wouldn't customize padding even if there's an option.
kcaran commentedon May 8, 2020
I don't think you can assume that the underlying application will add an appropriate padding. For example, Outlook has a black background for displaying images. This is an example of an image I needed to post-process.
For the default, I'd rather have it be more generous because cropping is a much simpler post-processing edit than expanding the background.
lipis commentedon May 8, 2020
I don't think that we should have an option for it.. bit maybe increasing a bit the padding should be ok.
kyldvs commentedon Jun 5, 2020
I would really like some padding options, I had to wrap my entire drawing in a box unnecessarily so that the image would not feel cramped when sharing. In particular when sharing an image directly with someone and it's viewed in some lightbox the padding is necessary for content around the edges to look decent
dai-shi commentedon Jun 5, 2020
@kyldvs Do you need to change the padding size occasionally in your use cases, or just increasing works for most of your cases? Do you have a specific number in that case?
vjeux commentedon Jun 5, 2020
This sounds like a reasonable change to increase the default padding. @kyldvs do you want to play with the padding and send a PR to what you feel is right?
kyldvs commentedon Jun 5, 2020
I think the problem with a static size is that I drew a relatively large diagram, so when I send it and it is viewed in a lightbox it gets scaled down which makes the margins seem smaller. If I were to pick a fixed size appropriate for this large diagram I suspect it would be too large for smaller diagrams.
I think I would prefer it to be either a 3-state small/medium/large padding, or set a default but allow people to write in a custom padding.
vjeux commentedon Jun 5, 2020
Can you think about reasonable thresholds for when to have smaller or larger paddings based on the situation?
kyldvs commentedon Jun 5, 2020
It looks like I picked a margin of ~80px for my large diagram, when it is scaled down to the size of my screen it is ~16px.
An approach may be to have a default margin of some size (8px?) and then as the exported image grows increase (probably in increments of 4) up to a certain cap (64px? 128px?)
vjeux commentedon Jun 5, 2020
For anyone reading, I'm happy to accept a pull request if someone can come up with a heuristic for padding that seem reasonable.
dwelle commentedon Jun 5, 2020
I'll repost my sentiment from the PR: I think the case for adaptive padding isn't a good fit when embedding images in blog posts and similar (Medium, Twitter etc.). It'll make the image smaller to fit on screen/tweet, and thus harder to read bigger diagrams.
We should think about what's the most common case for PNG exporting, and tailor to that case first.
I'm not against customization in this regard.
keul commentedon Nov 18, 2020
I'm reviving this issue because I've a similar need, but the other way around: the fact that I find padding around my exported object is an issue for me.
I think that a controllable padding would be very useful (in my case: I need a 0 value)
lipis commentedon Nov 28, 2020
As we're not going to add an option for it.. I'm closing this issue.
architchandra commentedon Jul 14, 2023
Would love to see an option to control the padding around the exported image. Have to do all kinds of image manipulation stuff that I'm not good at to get the correct padding right now. Thanks!
kcaran commentedon Sep 20, 2023
I know this is closed but the workaround that @kyldvs mentioned to the padding issue works well for me. I add an invisible rectangle around the image that frames it. The export includes the frame and the space between it and the actual image. I wrote a blog post which hopefully includes more detail: https://www.kcaran.com/posts/excalidraw-add-padding-around-exported-image.html