Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce option to remove SVG background completely #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nobodyinperson
Copy link

@nobodyinperson nobodyinperson commented Jul 29, 2021

This Merge Request introduces an option --svg-no-background which causes the SVG background rectangle to be dropped. This can help when importing the resulting SVG into other software (like OpenSCAD) where the (invisible) background is then still recognised as an object.

This enables removing the background by adding e.g.
--background=00000000 which can help when importing the resulting SVG
into other software (like OpenSCAD) and the (invisible) background is
then still recognised as an object.
@lemniscati
Copy link

lemniscati commented Jul 29, 2021

I think some other softwares (e.g. Inkscape) unlike OpenSCAD might need a rect object as background in order to keep its image size with background while importing.

@nobodyinperson
Copy link
Author

No problem here with current Inkscape 1.1

@nobodyinperson
Copy link
Author

I you remove the background rect with Inkscape manually, it results in the same SVG file as not creating the background in the first place.

@lemniscati
Copy link

lemniscati commented Jul 29, 2021

I've tested with Inkscape 1.0.1 (Sorry, I don't have 1.1 yet).

  1. Make an SVG file by qrencode.
  2. Remove a background rect from the SVG file by a text editor. (I think this is the expected behavior in this pull request).
  3. Open a new document with Inkscape 1.0.1 (Win10)
  4. Import the edited SVG file into the Inkscape document (Include SVG image as editable object(s) in the current file).
  5. Save the Inkscape document.
  6. There is no rect object corresponding to the (removed) background rect.

That is, we lose the size of the QR code image with its background as an unexpected side effect.

There might be some other softwares like this...

@lemniscati
Copy link

I'm not a maintainer, but in my opinion, it would be sufficient to implement an explicit command line option to output no background rect for the purpose of this pull request...

This options causes `qrencode` to not put any background rectangle into
the SVG output. This rectangle might be unwanted, e.g. when importing
with OpenSCAD where setting the background alpha channel to 0 is not
enough.
@nobodyinperson nobodyinperson changed the title Only add SVG background if not fully transparent Introduce option to remove SVG background completely Jul 29, 2021
@nobodyinperson
Copy link
Author

@lemniscati I changed the Merge Request to introduce an option --svg-no-background. It is probably better this way as my original proposal might break backwards compatibility.

@lemniscati
Copy link

I agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants