I've completed several projects in inkescape, which include many JPEG files embedded. When I saved the files as PDF, I just found that inkscape saves embedded JPG/JPEG files as bitmap. This extremely increase the sizes of PDF files. Since these projects (PDF files) should be distributed via email, it is extremely important to minimize the size of PDF files.
Is there any way to save PDF with embedded JPG instead of bitmap? or minimize the PDF size by converting back the bitmap to lightweight jpg?
I wonder why inkscape does not have this feature to save PDF with embedded JPG. There should be at least a hack to do so.
How to save PDF with JPG embedded
Re: How to save PDF with JPG embedded
Hello,
your description is a bit confusing.
Do you mean bitmap as bmp?
As far as I know all raster elements are saved with jpeg compression,
meaning all embedded parts ARE jpegs no matter what you do.
Which is a shame, since pdf is the most reliable format for printing, and that compression is lossy.
On the other hand, inkscape doesn't have the ability to set that compression
(at least in the save as panel, maybe those who can compile inkscape can hack other compression rates as well.)
You could try some pdf printers like bullzip or cutepdf, to make pdf copies from your files.
They have some options to save with bigger compressions.
your description is a bit confusing.
Do you mean bitmap as bmp?
As far as I know all raster elements are saved with jpeg compression,
meaning all embedded parts ARE jpegs no matter what you do.
Which is a shame, since pdf is the most reliable format for printing, and that compression is lossy.
On the other hand, inkscape doesn't have the ability to set that compression
(at least in the save as panel, maybe those who can compile inkscape can hack other compression rates as well.)
You could try some pdf printers like bullzip or cutepdf, to make pdf copies from your files.
They have some options to save with bigger compressions.
Re: How to save PDF with JPG embedded
I don't think so. I attach an example.
I have a simple JPEG file with size 20.1 KB
when embedding it into a blank inkscape SVG file, the size of SVG file is 20.2 KB
but if saving it as PDF, the size is 97.6 KB
I have a simple JPEG file with size 20.1 KB
when embedding it into a blank inkscape SVG file, the size of SVG file is 20.2 KB
but if saving it as PDF, the size is 97.6 KB
Re: How to save PDF with JPG embedded
Hi.
Lazur Urh;
As far as I know - this is not correct, (I might be wrong - has happened before!).
If you open the XML editor and inspect the embedded image you will see it's actually embedded as a lossless png image encoded by 64bit ascii encoding.
It's relatively easy to copy the encoded text (from the XML editor in Inkscape) and decode it back into an image using python (or any other programming language).
The 'extracted' text from the 'pdf' example is 109656 bytes in size.
When it's saved in the pdf file it is compressed using the 'FlateDecode' filter- that's why the pdf file is slightly smaller in size.
The 'compressed' part of the pdf file is 96337 bytes - the whole pdf file is 97639 bytes.
(this part can be 'decompressed' as well using python; http://binaryhax0r.blogspot.com/2010/06/flatedecode-decoder.html)
By importing the PDF example (in inkscape) and clear the 'Embed Images' 'tickbox' the embedded image(s) will be saved as png file(s) to your disk,
this happens automatically when importing (this is a nice way to 'extract' all images from a PDF file!).
RGDS
Ragnar
Lazur Urh;
As far as I know all raster elements are saved with jpeg compression,
meaning all embedded parts ARE jpegs no matter what you do.
Which is a shame, since pdf is the most reliable format for printing, and that compression is lossy.
As far as I know - this is not correct, (I might be wrong - has happened before!).
If you open the XML editor and inspect the embedded image you will see it's actually embedded as a lossless png image encoded by 64bit ascii encoding.
It's relatively easy to copy the encoded text (from the XML editor in Inkscape) and decode it back into an image using python (or any other programming language).
The 'extracted' text from the 'pdf' example is 109656 bytes in size.
When it's saved in the pdf file it is compressed using the 'FlateDecode' filter- that's why the pdf file is slightly smaller in size.
The 'compressed' part of the pdf file is 96337 bytes - the whole pdf file is 97639 bytes.
(this part can be 'decompressed' as well using python; http://binaryhax0r.blogspot.com/2010/06/flatedecode-decoder.html)
By importing the PDF example (in inkscape) and clear the 'Embed Images' 'tickbox' the embedded image(s) will be saved as png file(s) to your disk,
this happens automatically when importing (this is a nice way to 'extract' all images from a PDF file!).
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar