fukuchi / libqrencode

A fast and compact QR Code encoding library
https://fukuchi.org/works/qrencode/
GNU Lesser General Public License v2.1
2.57k stars 599 forks source link

Introduce option to remove SVG background completely #184

Open nobodyinperson opened 3 years ago

nobodyinperson commented 3 years ago

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.

lemniscati commented 3 years ago

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 commented 3 years ago

No problem here with current Inkscape 1.1

nobodyinperson commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

nobodyinperson commented 3 years ago

@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 commented 3 years ago

I agree.