How to import an existing svg with svgwrite - Python - python

I need to import an existing svg picture and add elements like circle and square on it. My file is 'test.svg' so i tryed dwg = svgwrite.Drawing('test.svg') but it create a new svg file without anything.
I use the python lib svgwrite, do you have any idea for me?
Thank you, and sorry for my english... I do my best!

svgwrite will only create svg files. svgwrite does not read svg files. If you want to read, modify and then write the svg, the svgwrite package is not the package to use but I do not know of an appropriate package for you.
It might be possible to create svg which uses a reference to another image. That is there is one svg which you then put a second svg on top of the first. I have not done this and do not know if it would actually work.

Related

Change a tag of metadata from jpg with python

I would to know if is it posible to change the tag mark on the image with python:
I've tried using pyexif and directly PIL but i cant found the tag or the way to change it in python.
Thanks

How linking a image with attach files on PDF using Python?

how are you?
I have a problem and I don't can solved. I need to make a link between an image and attach a tiff file on using Python.
I use pyfpdf to create my PDF, and after the solution (
How to attach mulitple files in PDF?) for attaching the files that I need.
Does anyone have any suggestions? Or some example?
Thanks
Thanks

Is there a way to save an inline shape from docx as an image file?

I'm trying to parse a docx file using python-docx. The file contains images and text. Basically i need a way to take an image(an InlineShape object) from the file and save it as a separate image (like "smth.jpg"). Is there a way to do that? From reading the API docs it doesn't seem like it, but maybe i'm missing something.
docx2python will pull these images for you.
from docx2python import docx2python
content = docx2python('my_document.docx', 'output_image_directory')
The images will be in whatever directory you supply.
OK, i've figured put a way. Converting docx file to zip and extracting from there. It's not the best option, but still pretty good for me.

Basic shape file display using PyQt

Are there any packages that allow for the interactive display of GIS shapefiles? I'm looking to create a simple GUI that displays simple shapefiles (coastlines, etc) but can't seem to find where to start. I was originally tasked with doing this in R but I would like to try and use python and Qt.
Mapnik supports GIS shape files and has a Python interface.
I think you can use a combination of the shapefile library for reading files, and shapely for all the processing of the data.
I have used shapely for working with geo data feeds that have been loaded into a database, to work with the point and polygon data.
Per your comments, if you just want to simply display a shapefile in your PyQt app, then really all you need is to convert it to an SVG and display it directly. I have not used this conversion lib but I am sure there are more like it. Then you can just use a QSvgWidget to load and display it

Python library which allows me to add text on top of images

do you know if there is a Python image library which allows me to add text on top of images?
PIL can do that (it's the standard image processing library for Python anyway).
on google: "PIL add text on top of images"
first result: http://python-catalin.blogspot.com/2010/06/add-text-on-image-with-pil-module.html
anyway, if you're looking for the library, you want to check into PIL

Categories

Resources