Hi, All.
I already wrote this question in the inkscape-user list but no one came to me with a good solution. My problem is that I have a SVG image too big. In fact is more than one. They are five SVG files with size of 20880 pixels width by 37800 pixels height. I have to export PNG files of slices that must have 180 pixels width by 150 pixels height. I know that I could do this creating an array of squares in a separate layer and, using the batch export, export every peace. The problem is that I need that every PNG file export must have an specific name. They must have the theis X and Y positon from where they come from in the original image. For example, if one PNG came from a peace at 0:0:180:150 it must be named "0x0.png". The peace that came from 180:150:360:300 must be named "180x150.png". I already made a batch file (I am using Windows XP with Inkscape 0.46) but it is too slow. I left it running almost 16 hours strait and it didn't finished the first file yet.
There is someone that can help me with that? Is really important. Thanks a lot.
Alessandro Antonello
_________________________________________________________________ Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o Messenger! É GRÁTIS! http://www.msn.com.br/emoticonpack
On Thu, Dec 4, 2008 at 12:31 PM, Alessandro Antonello <aleantonello@...19...> wrote:
Hi, All.
I already wrote this question in the inkscape-user list but no one came to me with a good solution. My problem is that I have a SVG image too big. In fact is more than one. They are five SVG files with size of 20880 pixels width by 37800 pixels height. I have to export PNG files of slices that must have 180 pixels width by 150 pixels height.
This is rather meaningless measure of bigness for vector images :) How many objects? Nodes? Bytes in SVG? Does it use blur (most important!), transparency, gradients?
batch file (I am using Windows XP with Inkscape 0.46) but it is too slow. I left it running almost 16 hours strait and it didn't finished the first file yet.
Looks like it has blur or other filters. In that case, you would need to download the latest dev build, it is much faster than 0.46 in exporting blur.
Hi, Mr. Byak.
I know that, for a vector image, the width and height in pixels is meaninless. It is built with a series of PNG images and text objects. About 2900 in each file. I have to slice every file in 29,232 parts. Each part will have 180px width and 150px height. Also, every part must be named with their source X and Y coordinates.
The source SVG is not too big, in bytes. It has about 20 MB because of the series of PNG imagens on it. It dosn't have any efect like blur or other, transparency or other thing. Well, the background color for the page is nothing, if this means something.
Maybe I did something wrong in the batch script. It is so simple. Maybe I can't see something obvius.
--------------------------------------------------------------------------------
for /l %%Y in (0,150,37650) do ( for /l %%X in (0,180,20700) do ( call :export_file %%Y %%X ) ) goto :EOF
rem %1 is Y coord. %2 is X coord. :export_file
set /a RIGHT=%2 + 180 set /a TOP=%1 + 150 inkscape -e ../target-dir/%2x%1.png -a %2:%1:%RIGHT%:%TOP% source.svg goto :EOF --------------------------------------------------------------------------------
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working. So, I had no alternatives. There is something else that can be done?
Thanks, Alessandro Antonello
-------------------------------------------------- From: "bulia byak" <buliabyak@...400...> Sent: Thursday, December 04, 2008 2:46 PM To: "Alessandro Antonello" <aleantonello@...19...> Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Script to export images
On Thu, Dec 4, 2008 at 12:31 PM, Alessandro Antonello <aleantonello@...19...> wrote:
Hi, All.
I already wrote this question in the inkscape-user list but no one came to me with a good solution. My problem is that I have a SVG image too big. In fact is more than one. They are five SVG files with size of 20880 pixels width by 37800 pixels height. I have to export PNG files of slices that must have 180 pixels width by 150 pixels height.
This is rather meaningless measure of bigness for vector images :) How many objects? Nodes? Bytes in SVG? Does it use blur (most important!), transparency, gradients?
batch file (I am using Windows XP with Inkscape 0.46) but it is too slow. I left it running almost 16 hours strait and it didn't finished the first file yet.
Looks like it has blur or other filters. In that case, you would need to download the latest dev build, it is much faster than 0.46 in exporting blur.
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org
Alessandro Antonello wrote:
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working. So, I had no alternatives. There is something else that can be done?
If the slowness turns out to be the time it takes Inkscape to render the image, what if you exported the PNG once to a temp file, then used something like ImageMagick to slice out the parts of the image that you wanted?
John
Alessandro,
It seems that this might be best handled in a program external to Inkscape. That is export one big .png from inkscape and then crop it in another program that supports batch processing or can be called from an external script.
Imagemagick comes to mind. http://www.imagemagick.org
It plays nice with scripts and can probably do what you want using the convert http://www.imagemagick.org/script/convert.php and crop commands http://www.imagemagick.org/script/command-line-options.php#crop
I may be way off base here (and probably off topic ITO the purpose of the list), but it might be a better solution to your problem.
Good Luck, Jamie
"It is a mistake to think you can solve any major problems with just potatoes."--Douglas Adams __________________ Jamie Kimberley Postdoctoral Fellow Department of Mechanical Engineering The Johns Hopkins University Office: 410.516.5162 Mobile: 217.621.8272 Fax: 410.516.4316 E-Mail:jamie.kimberley@...1884...
On Fri, 5 Dec 2008, Alessandro Antonello wrote:
Hi, Mr. Byak.
I know that, for a vector image, the width and height in pixels is meaninless. It is built with a series of PNG images and text objects. About 2900 in each file. I have to slice every file in 29,232 parts. Each part will have 180px width and 150px height. Also, every part must be named with their source X and Y coordinates.
The source SVG is not too big, in bytes. It has about 20 MB because of the series of PNG imagens on it. It dosn't have any efect like blur or other, transparency or other thing. Well, the background color for the page is nothing, if this means something.
Maybe I did something wrong in the batch script. It is so simple. Maybe I can't see something obvius.
for /l %%Y in (0,150,37650) do ( for /l %%X in (0,180,20700) do ( call :export_file %%Y %%X ) ) goto :EOF
rem %1 is Y coord. %2 is X coord. :export_file
set /a RIGHT=%2 + 180 set /a TOP=%1 + 150 inkscape -e ../target-dir/%2x%1.png -a %2:%1:%RIGHT%:%TOP% source.svg goto :EOF
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working. So, I had no alternatives. There is something else that can be done?
Thanks, Alessandro Antonello
From: "bulia byak" <buliabyak@...400...> Sent: Thursday, December 04, 2008 2:46 PM To: "Alessandro Antonello" <aleantonello@...19...> Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Script to export images
On Thu, Dec 4, 2008 at 12:31 PM, Alessandro Antonello <aleantonello@...19...> wrote:
Hi, All.
I already wrote this question in the inkscape-user list but no one came to me with a good solution. My problem is that I have a SVG image too big. In fact is more than one. They are five SVG files with size of 20880 pixels width by 37800 pixels height. I have to export PNG files of slices that must have 180 pixels width by 150 pixels height.
This is rather meaningless measure of bigness for vector images :) How many objects? Nodes? Bytes in SVG? Does it use blur (most important!), transparency, gradients?
batch file (I am using Windows XP with Inkscape 0.46) but it is too slow. I left it running almost 16 hours strait and it didn't finished the first file yet.
Looks like it has blur or other filters. In that case, you would need to download the latest dev build, it is much faster than 0.46 in exporting blur.
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On Thu, Dec 4, 2008 at 10:33 PM, Alessandro Antonello
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working.
It works in the devel version. However, it only saves you time for starting up and shutting down Inkscape. If each slice is exported for a long time (if I understood you correctly) then this gain will be negligible. Its primary advantage is for exporting many fast and small files in succession.
I agree that overall, it is likely to be faster to export the entire file to bitmap, then slice the bitmap. However, I never tried to slice bitmaps this large either, so I don't know how fast it will be.
On Fri, Dec 5, 2008 at 3:58 PM, bulia byak <buliabyak@...400...> wrote:
On Thu, Dec 4, 2008 at 10:33 PM, Alessandro Antonello
I can see that a problem in this script is that every time it calls a new instance of Inkscape. This is a problem. I read about the '--shell' command line option but seams to me that it is not working.
It works in the devel version. However, it only saves you time for starting up and shutting down Inkscape. If each slice is exported for a long time (if I understood you correctly) then this gain will be negligible. Its primary advantage is for exporting many fast and small files in succession.
I agree that overall, it is likely to be faster to export the entire file to bitmap, then slice the bitmap. However, I never tried to slice bitmaps this large either, so I don't know how fast it will be.
The need to slice raster images, (as well as raster images originating in vectors) crops up frequently enough that I decided to see what would take to write a small commandline tool using GEGL that loads the source image only once. For sources see:
http://svn.gnome.org/viewvc/gegl/trunk/examples/gegl-slicer.c?view=markup
A sample session of it in use:
pippin@...2099...:~/src/gegl/examples/test$ ls -R .: gegl.png out slice-list
./out: pippin@...2099...:~/src/gegl/examples/test$ cat slice-list # blank lines and lines and comments are ignored 291,486 100x120 foo.png 291,486 340x120 bar.png 8,611 650x50 baz.png pippin@...2099...:~/src/gegl/examples/test$ ../gegl-slicer gegl.png slice-list out/ out/foo.png (291,486 100x120) out/bar.png (291,486 340x120) out/baz.png (8,611 650x50) pippin@...2099...:~/src/gegl/examples/test$ ls -R .: gegl.png out slice-list
./out: bar.png baz.png foo.png pippin@...2099...:~/src/gegl/examples/test$
The task of repeatedly slicing images/compositions like this is something that occurs in workflows on both vector images and raster images, especially for web/GUI work. Editing a text file is not sufficient for most users though so tools (either in GIMP/inkscape) or stand-alone ones will be needed to streamline configuration of such automation.
It isn't as efficient in use probably as something that also has a GUI for specifying the different rectangular regions to be exported but it does do the job. It could probably have been written more neatly using Ruby or Python.
/Øyvind K.
participants (5)
-
Alessandro Antonello
-
bulia byak
-
Jamie Kimberley
-
John Bintz
-
Øyvind Kolås