I have a very specific requirement, which is to :
1. read a obj file created in 3dsMax.
2. apply camera perspective projection on it
3. save the output in jpeg or any other image format
Please if someone could help me find a library or code to do this in python.
I have looked at pyglet, & pywavefront but could not succeed.
I want to build a web service for this use case hence the library has to be robust.
Please help me find the right tools.
The simplest way probably would be to write a script with 3ds max api or maya api..
OBj are simple, You can write an importer by yourself, that is just a file with ASCII text, with position of verticles.
As about
You can also use Away3D or simmilar. This may probbalby work in a browser
Related
I have a requirement involving making a large pptx file with loads of charts, images and tables dynamic. This pptx has default styles. Is there any library or method to make a template so that I can insert the dynamic parts. Like docxtpl library allows us to input a dict and generate a docx file.
Thanks.
You can try the following python modules:
https://pypi.org/project/template-pptx-jinja/
https://pypi.org/project/pptx-template-simple/
https://pypi.org/project/python-pptx-templater/
With the first one, the example they show, it works fine, but im having trouble applying it in another custom ppt.. keep getting "Unepexpected end of template".
The third one didint work for me though, maybe you have more luck.. and now i will try the second one.
I'm not sure I understand your problem...
python-pptx (a tag you've used) is the fundamental programmable way to build a presentation - whether from a "template presentation or not.)
I hope nobody will mind me advertising my md2pptx open source project for taking Markdown and images and making a presentation.
However, I think md2pptx doesn't help you unless you have a way of turning graphs into eg PNG files - and I suspect that's not what you want.
Is it possible to convert Dwg to pdf file using Python?
I have multiple Dwg files that need to convert to pdf.
I am experimenting to create an app to convert but can not find any solution?
Please, if you have any idea help.
Vector Express is a free API you may able to use. (requires a network connection, though)
https://github.com/smidyo/vectorexpress-api
Of course it is possible to write a code in Python to publish DWG file as PDF.
However, DWG is a proprietary file format from AutoCAD, therefore there are a lot of legal issues to distribute the code (beyond your private usage), unless you get a written consent from AutoCAD...
You'll find several application that would already do the job.
Maybe check Open Design Alliance as a starting point.
Using QCAD Command Line Tools (Open Source)
According to qcad.org "QCAD is a free, open source application for computer aided drafting (CAD) in two dimensions (2D). With QCAD you can create technical drawings such as plans for buildings, interiors, mechanical parts or schematics and diagrams. QCAD works on Windows, macOS and Linux. The source code of QCAD is released under the GPL version 3 (GPLv3), a popular Open Source license."
Supported Command Line Conversions
dwginfo
dwg2csv
dwg2bmp
dwg2svg
dwg2pdf
dwgmapconvert
dwg2maptiles
dwg2dwg / pdf2dwg
dwghatch
dwghatcharea
dwgexplode
merge
bbox
dwgnest (QCAD/CAM)
The above commands are very self-explanatory for further information please refer to the above embedded url at qcad.org
Usage in Python
Though I believe that this might not be best practice but a os.system command as follows, might be enough for most use cases
I'm gathering basic metadata for images - mainly their dimensions, although it'd be nice to get any other available metadata as well. The image formats I'm interested in are png, jpg, and gif.
I'm using PIL at the moment, but it occurred to me there may be a simpler way that doesn't involve external dependencies or binary libraries. Is there one?
I don't think there is anything built in, but if you look up those file formats, you will find that the size is encoded near the beginning of the file.
You can use the struct module to parse just enough of the header to work out the size
Answer: No there is not a simpler way than using an external library.
If you are only going to care about one and one file format only, then yes. Then it's easy to implement something specific for that. But if you want to be generic, you need to support a lot of file formats, and then you don't want to do all that work yourself.
To simplify install of PIL, you might look at Pillow, a friendly forkĀ§ that makes PIL easy_installable.
See ImageMagick, a fantastic library for dealing with bitmap images. The identify tool from the command line suite will do what you want. There are also a few Python interfaces.
I'm creating a "slideshow room" web page. The user will upload a PowerPoint file that my server will use to generate a set of .jpg image files representing the slides to present in a custom "gallery viewer".
I'm an experienced Python developer but I cannot find anything useful.
How can I do that?
Off the top of my head, the way I'd do it:
Use OpenOffice.org to convert the .ppt file into a PDF. (OO.o has a very rich Java API. Rich and bloody difficult to use, mind, but once you figure out how to get it to do the task you need, you're all set. Dunno if you can do anything useful with it via Python; not my language.)
Use ImageMagick to convert the PDF into .jpg files. (Though I've been told converting the PDF into a PS file before turning it into images gives better results.) (IM's command line interface is damn near a language unto itself -- though again, once you figure out how to get it to do what you want, you're all set.)
Dunno if that's the most efficient/reliable way to do it. But fundamentally, I'd be on Google trolling for open-source third party tools that do all the dirty work for me.
Apache POI and Jython. POI, even has an ImageExtractor class, but having just glanced at the Javadocs, I suspect it is incomplete.
Are you doing this on Windows? If so win32 com:
import win32com.client
Application = win32com.client.Dispatch("PowerPoint.Application")
Application.Visible = True
Presentation = Application.Presentations.Open(pathToPPT)
Presentation.Slides[1].Export("C:/path/to/jpg.jpg", "JPG", 800, 600);
etc...
I'm having a set of Python scripts that process the photos. What I would like is to be able to create some kind of flash-presentation out of those images.
Is there any package or 'framework' that would help to do this?
I don't know of any Python-specific solutions but there are multiple tools to handle this:
You can create a flash file with dummy pictures which you then replace using mtasc, swfmill, SWF Tools or similar. This way means lots of trouble but allows you to create a dynamic flash file.
If you don't need dynamic content, though, you're better off creating a video with ffmpeg. It can create videos out of multiple images, so if you're somehow able to render the frames you want in the presentation, you could use ffmpeg to make a video out of it.
If you only want charts, use SWF Charts.
You could use external languages that have a library for creating flash files.
And finally there was another script language that could be compiled into several other languages, where swf waas one of the targets, but I can't remember its name right now.
You should generate a formated list with the data to your photos, path and what else you need in your presentation.
That data you load into a SWF, where your presentation happens.
Like that you can let python do what it does and flash what flash does best.
You might find allready made solutions for flash galleries / slideshows. http://airtightinteractive.com/simpleviewer/ is a famous one. You can load your custom xml in it.
Check out Ming, it seems to have Python bindings.
Ming is powerful but you might not find it pythonic to work with.
I prefer Haxe for Flash work. (It's the successor of MTASC)