Shrinking the results of JPG to SVG conversion
Hi all,
I have a number of *.jpg files that I need to convert to svg. I am using inkscape for the conversion. The problem is that the resulting svg is almost 5 times the size of the jpeg file. I have tried saving the file in compressed plain svg but with no success. The file is still very large. Is there anything I can do to shrink the file? I have run an open source cleanup tool called cleanSVG downloadable from codeplex but that has not helped.
I am open to using other JPG to SVG converters if inkscape is not the right tool for this exercise. Natively creating SVG is not an option at this point. Pranav
On Tue, 17 Apr 2012 06:23:26 +0530 "Pranav Lal" <pranav.lal@...155...> wrote:
Hi all,
I have a number of *.jpg files that I need to convert to svg. I am using inkscape for the conversion. The problem is that the resulting svg is almost 5 times the size of the jpeg file. I have tried saving the file in compressed plain svg but with no success. The file is still very large. Is there anything I can do to shrink the file? I have run an open source cleanup tool called cleanSVG downloadable from codeplex but that has not helped.
I am open to using other JPG to SVG converters if inkscape is not the right tool for this exercise. Natively creating SVG is not an option at this point. Pranav
Probably the resulting svg would compress well in a .zip or .tgz. I think the problem is that .svg is a vector format, .jpg is a bitmap format, and a raw conversion would just make an XML description of the bitmap. If you could hand-process the bitmap to turn parts of it into vector objects, that would tremendously shrink the .svg.
Thanks
SteveT
Steve Litt * http://www.troubleshooters.com/ Troubleshooting Training * Human Performance
On Tue, Apr 17, 2012 at 8:53 AM, Pranav Lal <pranav.lal@...155...> wrote:
Hi all,
I have a number of *.jpg files that I need to convert to svg. I am using inkscape for the conversion. The problem is that the resulting svg is almost 5 times the size of the jpeg file. I have tried saving the file in compressed plain svg but with no success. The file is still very large. Is there anything I can do to shrink the file? I have run an open source cleanup tool called cleanSVG downloadable from codeplex but that has not helped.
I am open to using other JPG to SVG converters if inkscape is not the right tool for this exercise. Natively creating SVG is not an option at this point. Pranav
how did you do the "conversion"?
as far as i know, you can directly embed your binary jpeg file inside svg with base64 encoding. that way, the result svg file should not be much larger than the original jpeg file.
i am not sure how to do this in inkscape. but you should be able to write a small script to do this.
best regards,
On Apr 16, 2012, at 7:00 PM, Auguste Pop wrote:
how did you do the "conversion"?
as far as i know, you can directly embed your binary jpeg file inside svg with base64 encoding. that way, the result svg file should not be much larger than the original jpeg file.
i am not sure how to do this in inkscape. but you should be able to write a small script to do this.
That's usually not really a good approach.
Embedding a binary jpeg file in an SVG file expands it by 33%, not to mention various in-memory issues that can arise. Of course, 133% is not nearly as bad as 500%, but it's generally not as helpful. For editing, it can really cause problems, as in-memory string storage can go way up.
Hi all,
Many thanks for your responses. I am on gmail's web interface as of now so am responding to all the posts so far in a single message.
I am trying to imbed Images in an epub book. This book could be read on a variety of devices so I am hoping to use SVG to render the image correctly (for want of a better word) on each device the book is opened. The book will be transmitted over the Internet in a low bandwidth situation so I am trying to shrink the SVG files.
As for the conversion, I am using the -l commandline option to produce plane svg.
I would love to be able to convert some of the SVG to objects but have not found an automated tool to do this. I could write my own using shape recognition algorithms but that is my last resort.
Pranav
On 4/17/12, Jon Cruz <jon@...204...> wrote:
On Apr 16, 2012, at 7:00 PM, Auguste Pop wrote:
how did you do the "conversion"?
as far as i know, you can directly embed your binary jpeg file inside svg with base64 encoding. that way, the result svg file should not be much larger than the original jpeg file.
i am not sure how to do this in inkscape. but you should be able to write a small script to do this.
That's usually not really a good approach.
Embedding a binary jpeg file in an SVG file expands it by 33%, not to mention various in-memory issues that can arise. Of course, 133% is not nearly as bad as 500%, but it's generally not as helpful. For editing, it can really cause problems, as in-memory string storage can go way up.
Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On Apr 16, 2012, at 9:59 PM, Pranav Lal wrote:
Many thanks for your responses. I am on gmail's web interface as of now so am responding to all the posts so far in a single message.
I am trying to imbed Images in an epub book. This book could be read on a variety of devices so I am hoping to use SVG to render the image correctly (for want of a better word) on each device the book is opened. The book will be transmitted over the Internet in a low bandwidth situation so I am trying to shrink the SVG files.
As for the conversion, I am using the -l commandline option to produce plane svg.
I would love to be able to convert some of the SVG to objects but have not found an automated tool to do this. I could write my own using shape recognition algorithms but that is my last resort.
That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg. http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Trace.html
The main place to gain size reductions is in the initial conversion. Sometimes this also can be aided by cleanup or simplification of the image before tracing.
Hi Jon, <snip That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg. PL] Thanks for your response. The original image is a Jpeg file which I am opening in inkscape.
Pranav
On 4/17/12, Jon Cruz <jon@...204...> wrote:
On Apr 16, 2012, at 9:59 PM, Pranav Lal wrote:
Many thanks for your responses. I am on gmail's web interface as of now so am responding to all the posts so far in a single message.
I am trying to imbed Images in an epub book. This book could be read on a variety of devices so I am hoping to use SVG to render the image correctly (for want of a better word) on each device the book is opened. The book will be transmitted over the Internet in a low bandwidth situation so I am trying to shrink the SVG files.
As for the conversion, I am using the -l commandline option to produce plane svg.
I would love to be able to convert some of the SVG to objects but have not found an automated tool to do this. I could write my own using shape recognition algorithms but that is my last resort.
That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg. http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Trace.html
The main place to gain size reductions is in the initial conversion. Sometimes this also can be aided by cleanup or simplification of the image before tracing.
Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
On 17/04/2012 08:38, Pranav Lal wrote:
The usual way is to use the 'Trace Bitmap' functionality
Just watch the size and complexity of the traced result. It can be very slow with thousands of little curves.
I forget the terms now, but you can dial-down the sensitivity to 'dots' and such, which is worth doing.
Play with the settings in the trace dialog. Each kind of image has a better approach. For example those with few colours can be clamped to only tracing 2 or 4 colours.
I have seen SVG files that are bigger (much) than the original image file. It's all in the number and length of paths really.
A large, complex trace is going to eat memory too -- so the viewing of such traces may be a problem on your client side.
\d
On 04/17/2012 09:38 AM, Pranav Lal wrote:
Hi Jon, <snip That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg.
PL] Thanks for your response. The original image is a Jpeg file which I am opening in inkscape.
If your images are photos, then SVG probably is not the right format for them, the result will be huge and at a bad quality. If the images are drawings, then the best is to trace and then manually adjust the result (or even redraw them - a manual trace).
Hi nicu,
the images are phhotos. The reason I am converting to SVG is that if I understand things correctly, it will scale better on a variety of devices and screen sizes.
Pranav
-----Original Message----- From: Nicu Buculei [mailto:nicu_gfx@...2342...] Sent: Tuesday, April 17, 2012 1:35 PM To: Inkscape User Community Subject: Re: [Inkscape-user] Shrinking the results of JPG to SVG conversion
On 04/17/2012 09:38 AM, Pranav Lal wrote:
Hi Jon, <snip That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg.
PL] Thanks for your response. The original image is a Jpeg file which I am opening in inkscape.
If your images are photos, then SVG probably is not the right format for them, the result will be huge and at a bad quality. If the images are drawings, then the best is to trace and then manually adjust the result (or even redraw them - a manual trace).
Hi Pranav,
That would be true of a from-scratch SVG that's truly a vector graphic, but I don't think it would be true for an SVG'ized JPG that's basically an SVG wrapper around a JPG bitmap. I think you mentioned earlier in this thread that your photos are over a megabyte in size. That should scale pretty well on everything but the biggest screens.
You never mentioned whether these will be used in a website, a PDF document, an EPUB book, or something else. Where will they be used?
SteveT
On Thu, 19 Apr 2012 21:43:29 +0530 "Pranav Lal" <pranav.lal@...155...> wrote:
Hi nicu,
the images are phhotos. The reason I am converting to SVG is that if I understand things correctly, it will scale better on a variety of devices and screen sizes.
Pranav
-----Original Message----- From: Nicu Buculei [mailto:nicu_gfx@...2342...] Sent: Tuesday, April 17, 2012 1:35 PM To: Inkscape User Community Subject: Re: [Inkscape-user] Shrinking the results of JPG to SVG conversion
On 04/17/2012 09:38 AM, Pranav Lal wrote:
Hi Jon, <snip That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg.
PL] Thanks for your response. The original image is a Jpeg file which I am opening in inkscape.
If your images are photos, then SVG probably is not the right format for them, the result will be huge and at a bad quality. If the images are drawings, then the best is to trace and then manually adjust the result (or even redraw them - a manual trace).
-- nicu :: http://nicubunu.ro :: http://nicubunu.blogspot.com
-- Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Steve Litt skrev 2012-04-19 20:04:
Hi Pranav,
That would be true of a from-scratch SVG that's truly a vector graphic, but I don't think it would be true for an SVG'ized JPG that's basically an SVG wrapper around a JPG bitmap. I think you mentioned earlier in this thread that your photos are over a megabyte in size. That should scale pretty well on everything but the biggest screens.
You never mentioned whether these will be used in a website, a PDF document, an EPUB book, or something else. Where will they be used?
SteveT
On Thu, 19 Apr 2012 21:43:29 +0530 "Pranav Lal" <pranav.lal@...155...> wrote:
Hi nicu,
the images are phhotos. The reason I am converting to SVG is that if I understand things correctly, it will scale better on a variety of devices and screen sizes.
Pranav
-----Original Message----- From: Nicu Buculei [mailto:nicu_gfx@...2342...] Sent: Tuesday, April 17, 2012 1:35 PM To: Inkscape User Community Subject: Re: [Inkscape-user] Shrinking the results of JPG to SVG conversion
On 04/17/2012 09:38 AM, Pranav Lal wrote:
Hi Jon, <snip That tells us on how you save the SVG once it had been created, but not how the SVG was originally done.
The usual way is to use the 'Trace Bitmap' functionality on an imported jpg and then removing the reference to the jpg. PL] Thanks for your response. The original image is a Jpeg file which I am opening in inkscape.
If your images are photos, then SVG probably is not the right format for them, the result will be huge and at a bad quality. If the images are drawings, then the best is to trace and then manually adjust the result (or even redraw them - a manual trace).
-- nicu :: http://nicubunu.ro :: http://nicubunu.blogspot.com
-- Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
First: http://zombiwoof.deviantart.com/gallery/12392182#/d46z8l2
The image is a SVG file, all vector, but "I" made it, a human. No trace program today can trace a photograph and do it to vector with this quality.
Vektor for webb is mostly logotypes, illustrations that have few colors. Trace photographs to vector can bee a expression, a manner. But they have few colors, like two or a few more/, but not //16,7 million colors as a bitmap can have. ///If you for example set the trace program to 6 million colors (I don't think it's possible) then you have SVG file with so much code, it's humungous, and for the web browser to read the code, and download it take time, a lot of time.
//Tommy Hjalmarsson/ //
Hi Steve,
The photos will be used in epub books that will be read on mobile phones.
Pranav
On Apr 19, 2012, at 6:12 PM, Pranav Lal wrote:
Hi Steve,
The photos will be used in epub books that will be read on mobile phones.
Pranav
If they convert to vector that is smaller, than changing them is good. If not, then keeping the bitmap version as jpeg and just wrapping it in an SVG container might be best.
This article
http://denis.papathanasiou.org/?p=592
recommends this simple type wrapper:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 592 900" preserveAspectRatio="xMidYMid meet"> <image width="592" height="900" xlink:href="images/page01.jpeg" /> </svg>
participants (7)
-
Auguste Pop
-
donn
-
Jon Cruz
-
Nicu Buculei
-
Pranav Lal
-
Steve Litt
-
Tommy Hjalmarsson