Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lyohaplotinka/images-pptx
A simple and blazing-fast javascript library for creating PPTX presentation from list of images
https://github.com/lyohaplotinka/images-pptx
Last synced: about 1 month ago
JSON representation
A simple and blazing-fast javascript library for creating PPTX presentation from list of images
- Host: GitHub
- URL: https://github.com/lyohaplotinka/images-pptx
- Owner: lyohaplotinka
- License: mit
- Created: 2020-03-07T11:31:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T02:39:12.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T08:18:17.381Z (about 1 month ago)
- Language: TypeScript
- Homepage:
- Size: 441 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - images-pptx - A simple and blazing-fast javascript library for creating PPTX presentation from list of images (TypeScript)
README
# images-pptx
### A simple and blazing-fast javascript library for creating PPTX presentation from list of images
If you have a set of raster picture files (for example, after converting PDF to JPG's) and you want to nicely wrap them into PowerPoint presentation–**images-pptx** is everything that you need.
Use it with pure Node.js or TypeScript: library is written on TS and has all typings.
#### Currently works:
| **Node.js** | **Browser** | **CLI** |
| :------------: | :------------: | :------------: |
| Yes | WIP | Yes |------------
### Installation
Via `npm`:
```bash
npm install --save images-pptx
```### Usage
Add it to your project:
```javascript
// JavaScript
const ImagesPptx = require('images-pptx')
// TypeScript
import * as ImagesPptx from 'images-pptx'
// or, for TypeScript
import { createPptx } from 'images-pptx';
```
After that, you can use it like this:
```javascript
await ImagesPptx.createPptx(options)
```Options are:
| **Option** | **Description** |
| :------------ | :------------ |
| pictures | Array of full paths to images (array of string) or single string to the directory where image files are placed |
| saveTo | Path to the directory (string) where .pptx file will be created |
| pptxFileName | Name of .pptx file (string) (default is "presentation.pptx" |
| extension | Extension of pictures (string, default: "jpg") which will be used in pptx (f.e. "jpg") |
| native | Boolean (default is `false`). Forces `images-pptx` use native OS commands, such as `cp` or `rm` on Mac and Linux instead of Node-based solutions. This solution can be a bit faster. **WARNING to Windows users:** this functionality was not tested correctly on Windows yet. |
| meta | Meta fields for presentation (see below)
Example usage:
```javascript
await ImagesPptx.createPptx({
pictures: '/Users/username/Pictures',
saveTo: '/Users/username/Presentation',
pptxFileName: 'Our great party.pptx',
extension: 'png',
native: true,
meta: {
author: 'Lyoha Plotinka',
title: 'Our great party!',
revision: 2,
createdAt: '2020-09-08T10:24:09.658Z'
}
})
```
This will generate file `/Users/username/Presentation/Our great party.pptx` with all the .png files from `/Users/username/Pictures`.For every key in `meta` objects there are default values:
* `Images-pptx presentation` from `title`;
* `Images-pptx` for `author`;
* `1` for `revision`;
* Output from `new Date().toISOString()` for `createdAt`### CLI usage
You can use `images-pptx` as command-line app. Install it globally or call it from node_modules folder.
For example:
```bash
npm install -g images-pptx
# after installing
images-pptx --help
# ...all usage options printed next
```### How fast is it?
All test were made on MacOS, using `console.time` and `console.timeEnd`| Options | Result |
| :------------ | :------------ |
| 3 pictures, ~8.5mb total; native: false; directory with extension as a path | 453.053ms |
| 3 pictures, ~8.5mb total; native: true; directory with extension as a path | 335.393ms |
| 27 pictures, ~49mb total; native: false; directory with extension as a path | 2518.479ms |
| 27 pictures, ~49mb total; native: true; directory with extension as a path | 1893.986ms |
| 3 pictures, ~8.5mb total; native: false; array of direct paths | 323.845ms |### TODO
1. Browser version of `images-pptx`
2. Proportional resizing of pictures### Found a bug?
Feel free to contribute, create an issue or contact me directly. All my contacts are availabe on [my website](https://lyoha.info)