Saving a vector graphics file properly

So, I have to color a square like this.
image
Since LO doesn’t allow gradient with 2 colors, I have to make on myself by joining 2 shapes, turn it into a metafile. Then, I can use the “image” option when coloring an item and choose the .emf file that I just created. The question is, which format should I choose that it doesn’t distort it? By distortion, I mean this:
image

As you can see, the diagonal reached exactly to the corner of the square before I saved it as an .emf file. Now, it doesn’t run exactly through the middle and there is more purple than there is orange. Is there a better format that would not distort images in any way (and preferably be editable with LO Draw? just a bonus)

Thanks in advance

1 Like

You would be better off by clicking File > Export and selecting as svg rather than emf (not a save as or export as option anyway) because svg has a wider range of use.

You can edit this simple svg easily in Draw by selecting the inserted svg and clicking Shape > break. For more complex shapes, Inkscape is better for editing svg files

A better idea for your own reuse and editing of your object is to:

  1. Create a new folder in Gallery. Restart LibreOffice after creating the new folder.
  2. Select both rectangles, click and hold for a second or two, then drag it into the new folder in Gallery.

You can reuse the object in the modules of LibreOffice by dragging it from Gallery onto a page, or right clicking it and selecting Insert

TwoTriangles.odg (16.8 KB)

1 Like

Thanks for the suggestion, I should have used .svg from the very beginning. One question though, when I save a file as .svg, I wanna just save the file and not the rest of the page, which is just blank. I reduce the page size to be exactly as the object size, say 30x30mm square. Sometimes I do see very small white space between the page border and the object even after rechecking that they are the same size. How do I make sure that the object snaps into the page? I have snapping on of course.

For example,
multicolor creator draft.odg (9.5 KB)
If I save this following file as svg, and choose it as my image to color an area and set style to “stretched”, white blank areas form around the image, which disappear if I set the style to “tiled”.
Are those white areas an indication that .svg file sees some space between the margins the area of the page and actually colored areas?
Even when it is tiled, and I enlarge the square, the white areas become more and more apparent.

I tested your file and my results (export selection) were as a tiled background for a writer file:

  • svg - white borders
  • webp - slight white borders
  • png - no white borders

Version: 7.6.7.2 (X86_64) / LibreOffice Community
Build ID: 60(Build:2)
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: en-US
Ubuntu package version: 4:7.6.7-0ubuntu0.20.04.1~lo1
Calc: threaded

Thank you for testing. I have already tested it with png and it does work as you described. However, it is a bitmap format. I am more interested in as to why this is happening? I mean both the page size and the file size is 30 mm and the object snaps to the borders. What could possibly cause this? It doesn’t make sense at all.

When you want to export just the object and not include the page as SVG, then make sure

  • you select the object(s) first and
  • You tick the box Selection only in the export save as dialogue

Cheers, Al

1 Like

Thank you for a potential solution. It doesn’t work unfortunately, the same white space on the lower and right sides still persist. I know I can just use png and be done with it, but I am still curious as to why those empty spaces persist when the object and paper size should be matching. I would appreciate an explanation of this, so I could have a better idea of how measurements work in LO.

I added default lines of the same colour around each object within the group and saved the group as svg. It behaves correctly as far as I see, without white lines around the group.
multicolor creator draft106750_EA.odg (31.5 KB)

1 Like

I wonder why the background of @ExtremeConfusion and @EarnestAl works differently when used as page backgrounds.
The difference seems to be “I added default lines of the same colour around each object within the group” (EarnestAl).
I haven’t known that this difference may be so important. If exported to png format that difference doesn’t matter. Am I right?
Thanks for working on this problem, interesting topic.


PageStyles_ExtremeConfusion_EarnestAl.odt (34.4 KB)

1 Like

All I can say, is that I have noticed that merging and subtracting objects seems to work best with the default line, as opposed to no line or a thicker line. I assumed that the same might also apply in this situation.

I tested with Transparency 99%, and it works; this way, the color of the line does not matter.
imagen
Look at the thin gray border in the original export, and no border in the other sample.
imagen

multicolor creator draft LeroyG.odg (13.9 KB)

1 Like

I should have mentioned that I created all these without a line. At this point, getting to produce an image is no issue for me. What I am interested in is figuring out why this happens. Why is there a discrepancy when the object size and the page size match exactly? On the other hand, if the color of the line is the same as the square, does it even need to have any transparency?

No; but with transparency you don’t need to set the line colors one by one.
This seems to be an import bug, because opening the .svg with Inkscape don’t show any border.

Just tested to export as emf, and I see no distortion.
I applied the emf as area image of a frame.
imagen

imagen
Version: 7.6.7.2 (x86) / LibreOffice Community
Build ID: dd47e4b30cb7dab30588d6c79c651f218165e3c5
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: es-MX (es_MX); UI: en-US
Calc: threaded

Bug 161558 - Object with no line exported as svg displays white border as area fill

Some things become clear

  • the larger the size of the object without a line used for the fill, the less pronounced the problems at the edges
  • It does affect png without line which shows blurring at the edges
  • It seems to be related to LibreOffice export, because Inkscape svg without line fills completely

WhiteBordersPlusPNGDefaultLine.odg (25.8 KB)

1 Like

So, the in the .emf file the diagonal meets exactly the corner of the square?
How exactly did you export it?

In the end though, there does seem to be a bug, and I am glad to have contributed to it being discovered.

imagen