Python – What format is used to store graphics

What format is used to store graphics… here is a solution to the problem.

What format is used to store graphics

I’m working on a project that involves working on charts extracted from other sources. Currently we are using Python’s networkx module for analyzing graphs.

I am now faced with the task of choosing a graphics storage format. Pickle seems to be a good choice for a purely python-based solution. However, we are now in the prototype design phase, and it is very likely that we will have to switch to C++ to solve the performance and scalability problems.

Therefore, I want to store my drawings in a format that is widely supported by most graphics libraries to minimize the headaches faced by future contributors in the project.

Can you give me some advice on which format I should use?


TGF is your solution.

Python example:


import fileinput, re

depends = {}
for line in fileinput.input():
    m = re.match('(.+):\s*(.*)',line) # find every depenency line of the form "<item>: <dependencies>"
    if m:
        item =
        dependency_list =
        print item,item # node definition

if dependency_list: # there are dependencies
            depends[item] = dependency_list.split() # store the list into a dictionary for later

print "#" # end of node list, start of edge list

for item in depends:
    for dependency in depends[item]:
        print item,dependency # edge definition

Related Problems and Solutions