Write metatags to EPS and JPG files
out of Inkscape SVG images
Files: | svg2eps_jpg.py - the program (python script)
svg2eps_jpg.html - this file (You're just reading) |
Summary: | Converting Inkscape-SVG metadata and writing them to EPS and JPG files. |
Author: | Peter Burger |
Revision: | 2010-12-12 First edition |
Copyright: | ©Copyright 2010 by Peter Burger under LGPL |
Disclaimer: |
Some people really need this (Maybe these people should better do a fair job!):
This is free software for Your personal purpose. No warranty about this software and other software which is used with it. You should always work with copies of Your files not with the original ones. You may use this software on Your own risk only. If You destroy Your work, please don't ask me why. You may modify or redistribute it under the terms of LGPL. All links don't reflect my opinion, no matter if their content is true or not. |
References: | http://www.inkscape.org/
http://owl.phy.queensu.ca/~phil/exiftool/ http://www.imagemagick.org |
Notes: | Following software is needed for a proper execution:
Following files are part of svg2eps_jpg.py (edit for Your own opinion!):
Also added for a lookup:
|
Description: |
Inkscape is a handy program to build vector images in SVG file format.
If these images should be offered to the stock market, it is necessary to convert them into EPS file format and build a corresponding JPG file (mostly equal or greater than 3 megapixel). Authors who want to sale their images are entitled to place their copyright and other notices into their offered files. This is done via so called metadata. Unfortunately there is no general system of metadata among the different file formats. Inkscape uses the metadata in its own Inkscape-SVG format only. With File Save As EPS the image is converted correctly, but the metadata are lost totally. The same is with File Bitmap Export (which makes a PNG file only), but most of the metadata is blown. Luckily exists ExifTool by Phil Harvey (http://owl.phy.queensu.ca/~phil/exiftool/), the only tool I've found which is able to handle all the metadata stuff that have to be done. The one and only step where we need another program is the conversion from PNG to JPG. Here helps the convert program from the ImageMagick suite (http://www.imagemagick.org/). First (of course) You've to create our image with Inkscape (I've done this with sample.svg). It's a good job to save the image periodically as Inkscape SVG. At the end of our creation enter Your metadata in File Document Metadata and save the image again. Then select all items with Work Select All in all Layers. Now do the pixel job with File Bitmap Export. In the popup window click the Selection tab, else Your bitmap is as large as the complete page. Changing the dpi value of bitmap size lets You change the megapixel size of the output. Normally values of 150, 300 or 600 dpi are used. Changed pixel values are shown, if You click on any other entry field. Multiplying the x and y values results the pixel area size. The outfile is always a PNG file, no matter what file extension in the field file name is entered, but You should care of the right file name in this field or You've to search it later. svg2eps_jpg.py needs strictly the same name as the inkscape file with .png extension. The next step is to build the EPS file, we need. This is done by File Save As and selecting EPS as output file format. Be careful that Export area is the whole page is not ticked. So the EPS file contents our selected image only instead of the whole page with the blank area around it. You'll find now 3 more files in Your directory:
If You play with the sample.svg file You'll see
Now quit Inkscape. Inkscape asks You for saving the file as Inkscape SVG again. If You've saved the file already (hopefully) as described above, You may ignore this and quit without saving. The last necessary step is to update the 3 .args files. Check out for all tags which are set with equal characters ('=')! Enter Your name, copyright notice, city and so on or You will give Your rights to another person. Be sure to
The following is for linux users, but in a similar manner this are the same steps for other operating system users too. We open a terminal window and change to our working directory (see cd command). You may use the dir or ls command to check if You're right. Our 3 files have to be present. Now we start the conversion:
With the sample file enter:
If You think the program is too verbose, set the two variables (pout_printing and perr_printing) in svg2eps_jpg.py to Your choice (True -> False). If the program was successfully You'll see the new created files (.xml, .eps and .jpg in Your directory. Control if all metadata was written correctly with (file.xml isn't needed any longer)
Now You're ready to upload Your files to Your image vendor -
PS: If You additional need a preview image in Your EPS file take a look at epstool by Russell Lang. This would be another blog, just as hint. |
Logouts: |
With the sample image I've checked the metadata usage of Inkscape:
Extracted metadata from sample save as inkscape svg:
Output of metadata with
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extracted metadata from sample save as normal svg:
Output of metadata with
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extracted metadata from sample save as optimized inkscape svg:
Output of metadata with
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extracted metadata from sample save as eps:
Output of metadata with
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output (after bitmap export) of metadata with
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||