libqrencode icon indicating copy to clipboard operation
libqrencode copied to clipboard

Introduce option to remove SVG background completely

Open nobodyinperson opened this issue 4 years ago • 7 comments

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.

nobodyinperson avatar Jul 29 '21 08:07 nobodyinperson

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.

lemniscati avatar Jul 29 '21 10:07 lemniscati

No problem here with current Inkscape 1.1

nobodyinperson avatar Jul 29 '21 10:07 nobodyinperson

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.

nobodyinperson avatar Jul 29 '21 10:07 nobodyinperson

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 avatar Jul 29 '21 11:07 lemniscati

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

lemniscati avatar Jul 29 '21 11:07 lemniscati

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

nobodyinperson avatar Jul 29 '21 13:07 nobodyinperson

I agree.

lemniscati avatar Jul 29 '21 13:07 lemniscati