LibreOffice Draw converts raster (png, jpg) to vector svg?

Paint programs, vector editors, 3d modelers, animation editors, etc.
Post Reply
Message
Author
User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

LibreOffice Draw converts raster (png, jpg) to vector svg?

#1 Post by mikeslr »

I wanted to convert one png image to svg. Neither mtpaint nor gimp could do it. I tried various online converters. One did a poor job. The rest wanted to sell me something. Found an online tutorial-video on how to do it using Inkscape: many steps involved and requires the full Inkscape. :(

So in desperation --figuring it was a waste of time-- I opened Libreoffice Draw. Imported the png. Exported the svg. Done. :D

mikesLr

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#2 Post by step »

Did Draw trace the image and actually convert lines and shapes into vectors, or did it embed the bitmap into an svg envelope? In the latter case scaling up the svg image will show pixelation just as badly as with a png image. And svg file size will be larger than the source png file size.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#3 Post by mikeslr »

Hi step,

I don't know enough to be able to answer your question. And I've misplaced the original svg that was created. So I've done another, starting with a png with a reasonable amount of detail and have attached both the original and the resulting svg. As svg isn't one of the extensions supported by the Forum, I've added a false ".gz" ending to it. Let us know what you find out.

Thanks,

mikesLr
Attachments
camera3.svg.gz
LibreDraw Converted to svg -- Remove false '.gz'
(106.5 KiB) Downloaded 236 times
camera3.png
Original png
(76.2 KiB) Downloaded 170 times

phat7
Posts: 179
Joined: Fri 05 Jun 2015, 08:54

#4 Post by phat7 »

106.5 KB vs. 76.2 KB ! No vector graphic here.

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#5 Post by mikeslr »

phat7 wrote:106.5 KB vs. 76.2 KB ! No vector graphic here.
Are you sure?

I just opened the file with the svg ending (after removing the false .gz) in inkscape lite. That application, which could see pngs and jpgs, couldn't open them.

Regarding the comparative file size difference between svgs and pngs, as far as I can tell, there is no absolute 'rule of thumb'. Rather, "When the number of paths / anchor points [of a vector graph] increase, the mathematical information to store them also increases! In these cases a bitmapped version of the file can be more suited for a lesser file size." https://graphicdesign.stackexchange.com ... -png-image. In other words, the size will depend on the amount of information to be presented. In order to evaluate the extent to which using Libre-Draw results in pixelation, I purposefully chose a graphic with a lot of detail.

mikesLr

mostly_lurking
Posts: 328
Joined: Wed 25 Jun 2014, 20:31

#6 Post by mostly_lurking »

I opened the SVG in Inkscape Lite and zoomed in - it was pixelated; I also opened it in Geany (an SVG is actually an XML text file), which showed the embedded PNG image data. It's definitely still a PNG image.

Besides - a tracing tool like the one in Inkscape won't give you an SVG representation of your picture, it will look more like a black-and-white photocopy made out of vector curves, which can be used as a base to manually redraw the image as vector graphic in Inkscape.

https://inkscape.org/en/doc/tracing/tut ... acing.html
Inkscape Tutorial wrote:Keep in mind that the Tracer's purpose is not to reproduce an exact duplicate of the original image; nor is it intended to produce a final product. No autotracer can do that. What it does is give you a set of curves which you can use as a resource for your drawing.

Potrace interprets a black and white bitmap, and produces a set of curves.[...]
Attachments
camera-img.png
(124.82 KiB) Downloaded 141 times

phat7
Posts: 179
Joined: Fri 05 Jun 2015, 08:54

#7 Post by phat7 »

Don't expect miracles.
Attachments
screenshot.jpg
(10.35 KiB) Downloaded 98 times
camera3.svg.gz
PNG traced with Inkscape (default settings) -- Remove false '.gz'
(39.35 KiB) Downloaded 229 times

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#8 Post by tallboy »

A second possibility:
I made .png screenshots of the different windows with the dialog below.
1) Drag and drop a .png to Dia
2) Save it as .dia
3) Export the .dia to more than 30 file formats.
4) Open the .svg in mtpaint
5) Expect some bluriness
Attachments
demo-1.png
(37.93 KiB) Downloaded 93 times
demo-2.dia.png
(60.15 KiB) Downloaded 135 times
True freedom is a live Puppy on a multisession CD/DVD.

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#9 Post by jamesbond »

I think mikeslr only need to re-format the PNG as SVG. It doesn't matter if the SVG is actually vector graphics or not ... as long as the format is SVG. And in that sense, mike has done the correct thing and accomplish what he needs to do.

As for really converting bitmaps to vectors, there are many tools (apart from actually stenciling the image by hand). This is one of them: http://autotrace.sourceforge.net/.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#10 Post by tallboy »

And besides, I never manage to upload the correct sequence of the more than 2 images... :?
True freedom is a live Puppy on a multisession CD/DVD.

Post Reply