Skip to content

Need option to have extra margin for generated image. #1556

Closed

Description

@karanganesan

eg.

Screenshot 2020-05-08 at 4 19 39 PM

it would be great to have 4 margin values to add or a single input to get padding values in pixels

Activity

  1. dwelle commented on May 8, 2020

    @dwelle
    Member

    We used to have an input where you could set custom padding, but removed it for simplicity's sake. What's your use case?

  2. added
    discussionopen for discussion; consensus not reached
    enhancementNew feature or request
    on May 8, 2020
  3. kcaran commented on May 8, 2020

    @kcaran

    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.

  4. dai-shi commented on May 8, 2020

    @dai-shi
    Member

    I would be happy even with a slightly more generous default padding.

    I actually agree with this.

    BTW, here's a workaround: https://excalidraw.com/#json=5685599130353664,NZWUVKsyFW3j9ysVutRtTA

  5. dwelle commented on May 8, 2020

    @dwelle
    Member

    @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.

  6. dai-shi commented on May 8, 2020

    @dai-shi
    Member

    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.

    image

    The same with Twitter: https://twitter.com/dai_shi/status/1256522186967248896


    removed it for simplicity's sake.

    I personally like the simplicity, so I wouldn't customize padding even if there's an option.

  7. kcaran commented on May 8, 2020

    @kcaran

    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.

    Screen Shot 2020-05-08 at 9 38 52 AM

    For the default, I'd rather have it be more generous because cropping is a much simpler post-processing edit than expanding the background.

  8. lipis commented on May 8, 2020

    @lipis
    Member

    I don't think that we should have an option for it.. bit maybe increasing a bit the padding should be ok.

  9. kyldvs commented on Jun 5, 2020

    @kyldvs

    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

  10. dai-shi commented on Jun 5, 2020

    @dai-shi
    Member

    @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?

  11. vjeux commented on Jun 5, 2020

    @vjeux
    Contributor

    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?

  12. kyldvs commented on Jun 5, 2020

    @kyldvs

    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.

  13. vjeux commented on Jun 5, 2020

    @vjeux
    Contributor

    Can you think about reasonable thresholds for when to have smaller or larger paddings based on the situation?

  14. kyldvs commented on Jun 5, 2020

    @kyldvs

    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?)

  15. vjeux commented on Jun 5, 2020

    @vjeux
    Contributor

    For anyone reading, I'm happy to accept a pull request if someone can come up with a heuristic for padding that seem reasonable.

  16. added
    help wantedExtra attention is needed
    and removed
    discussionopen for discussion; consensus not reached
    on Jun 5, 2020
  17. dwelle commented on Jun 5, 2020

    @dwelle
    Member

    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.

  18. keul commented on Nov 18, 2020

    @keul

    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)

  19. lipis commented on Nov 28, 2020

    @lipis
    Member

    For anyone reading, I'm happy to accept a pull request if someone can come up with a heuristic for padding that seem reasonable.

    As we're not going to add an option for it.. I'm closing this issue.

  20. architchandra commented on Jul 14, 2023

    @architchandra

    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!

  21. kcaran commented on Sep 20, 2023

    @kcaran

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions