Hi,
blockdiag.drawer.DiagramDraw.save() returnes image object.
For example, this is a part of blockdiag command.
https://bitbucket.org/blockdiag/blockdiag/src/07f96892bfda92b84f624afab987015f26ff7ff0/src/blockdiag/command.py?at=default&fileviewer=file-view-default
And as you can see, I changed to print the DiagramDraw returned
object and pass None as a filename.
If "svg" is passed to DiagramDraw, the output is XML string.
If "png" is passed, the output is png formatted binary object.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import sys
import blockdiag
import blockdiag.builder
import blockdiag.drawer
import blockdiag.parser
from blockdiag.utils.bootstrap import Application, Options
class BlockdiagApp(Application):
module = blockdiag
def build_diagram(self, tree):
DiagramBuilder = self.module.builder.SeparateDiagramBuilder
DiagramDraw = self.module.drawer.DiagramDraw
for i, group in enumerate(DiagramBuilder.build(tree)):
draw = DiagramDraw("svg", group, None, # <---- I CHANGED to None!
fontmap=self.fontmap,
antialias=self.options.antialias,
nodoctype=self.options.nodoctype,
transparency=self.options.transparency)
draw.draw()
print(draw.save()) # <---- I ALSO CHANGED HERE!
return 0
if __name__ == '__main__':
BlockdiagApp().run(sys.argv[1:])
----
WAKAYAMA Shirou
2016年2月23日 3:30 Martin7 <
marti...@gmail.com>:
> --
> このメールは Google グループのグループ「blockdiag-discuss」に登録しているユーザーに送られています。
> このグループから退会し、グループからのメールの配信を停止するには
>
blockdiag-disc...@googlegroups.com にメールを送信してください。
> その他のオプションについては
https://groups.google.com/d/optout にアクセスしてください。