vignette
Générateur de vignettes / prévisualisation pour 450 FileTypes différents dans Python.
Pré-requis
Ce package a été soigneusement testé sur les machines Linux. Si vous êtes confronté à un problème, publiez-le sur les problèmes de github.
Vignette dépend de Unoconv. (Universal Office Converter)
Vignette dépend de FFMPEG pour les fichiers audio ou vidéo
Vignette dépend de l'imagemagick pour la manipulation de l'image
apt-get install imagemagick
Vignette a également besoin d'être installée
Pour installer ce package:
Comment utiliser
Exemple de code:
from thumbnail import generate_thumbnail
// generate_thumbnail ( input , output , options )
options = {
'trim' : False ,
'height' : 300 ,
'width' : 300 ,
'quality' : 85 ,
'type' : 'thumbnail'
}
generate_thumbnail ( 'sample.docx' , './thumbnails/thumbnail.png' , options )
Vous devez transmettre trois paramètres dans la fonction générée_thumbnail.
Entrée : emplacement du fichier d'entrée. Vous pouvez voir la liste des fichiers pris en charge à la fin.
Sortie : emplacement du fichier miniature à générer. Il peut être .png, .jpg ou .gif
Options : il peut avoir cinq paramètres DIFF. Si vous ne voulez pas passer d'options, passez des options comme un blanc {}
- TRIM: Boolean (par défaut = true) il coupera automatiquement votre fichier.
- Hauteur: entier (par défaut = 300) Hauteur de la vignette dans PX.
- Largeur: entier (par défaut = 300) Largeur de la vignette dans PX.
- Qualité: entier (par défaut = 85) Qualité de la vignette sur une échelle de 1-100.
- Type: String (Default = "Thumbnail" Il faut deux valeurs "Thumbnail" ou "FirstPage" "Thumbnail" = 300x300 Image de la première page du document. La hauteur et la largeur peuvent être modifiées en fournissant des valeurs dans les options "FirstPage" = Snapshot de la première page du document.
Problèmes communs
ImageMagick Aucune image définie:
- Open /etc/imagemagick-6/policy.xml dans l'éditeur de votre choix
< ! -- Find this line(should be in the end of file) -- >
< policy domain= " coder " rights= " none " pattern= " PDF " / >
- Vous pouvez soit le commenter ou changer les droits de "lire | écrire"
- Référence: https://askubuntu.com/questions/1181762/ImageMagickConvert-im6-Q16-no-Images-Defined
Unoconv: Impossible de trouver une bibliothèque Pyuno appropriée et une combinaison binaire Python dans / usr / lib / libreOffice:
- Ouvert / usr / bin / unoconv dans l'éditeur de votre choix
- Remplacer #! / Usr / bin / env python3 par #! / Usr / bin / python3
- Référence: unoconv / unoconv # 405
Ce package est inspiré du module NPM FilePreview.
Types de documents pris en charge
La liste suivante des formats de documents est actuellement disponible pour l'exportation vers:
- Bib - bibtex [.bib]
- Doc - Microsoft Word 97/2000 / XP [.DOC]
- DOC6 - Microsoft Word 6.0 [.doc]
- DOC95 - Microsoft Word 95 [.doc]
- docbook - docbook [.xml]
- HTML - Document HTML (OpenOffice.org Writer) [.html]
- ODT - Open Document Text [.oDT]
- OTT - Texte de document ouvert [.ott]
- OOXML - Microsoft Office Open XML [.xml]
- PDB - aportiSdoc (Palm) [.pdb]
- PDF - Format de document portable [.pdf]
- PSW - Pocket Word [.PSW]
- RTF - Format de texte riche [.rtf]
- Latex - latex 2e [.ltx]
- SDW - StarWriter 5.0 [.sdw]
- SDW4 - StarWriter 4.0 [.sdw]
- SDW3 - StarWriter 3.0 [.sdw]
- STW - Open Office.org 1.0 Template de document texte [.stw]
- SXW - Open Office.org 1.0 Document texte [.sxw]
- Texte - Texte codé [.txt]
- txt - texte brut [.txt]
- VOR - Modèle StarWriter 5.0 [.vor]
- VOR4 - Modèle StarWriter 4.0 [.vor]
- VOR3 - Modèle StarWriter 3.0 [.vor]
- Xhtml - Document xhtml [.html]
La liste suivante des formats graphiques est actuellement disponible pour l'exportation vers:
- BMP - Windows Bitmap [.bmp]
- EMF - métafile amélioré [.EMF]
- EPS - PostScript encapsulé [.EPS]
- GIF - Format d'échange graphique [.gif]
- Document HTML - HTML (OpenOffice.org Draw) [.html]
- JPG - Group conjoint des experts photographiques [.jpg]
- Met - OS / 2 Metafile [.Met]
- Odd - OpenDocument Drawing [.ODD]
- OTG - Modèle de dessin OpenDocument [.otg]
- pbm - bitmap portable [.pbm]
- pct - mac pict [.pct]
- PDF - Format de document portable [.pdf]
- PGM - Graymap portable [.pgm]
- PNG - Graphique réseau portable [.png]
- PPM - Portable PixelMap [.ppm]
- Ras - Sun Raster Image [.RAS]
- STD - OpenOffice.org 1.0 Modèle de dessin [.std]
- SVG - Graphiques vectoriels évolutifs [.svg]
- SVM - StarView Metafile [.svm]
- SWF - Macromedia Flash (SWF) [.swf]
- sxd - openoffice.org 1.0 dessin [.sxd]
- sxd3 - Stardraw 3.0 [.sxd]
- sxd5 - Stardraw 5.0 [.sxd]
- TIFF - Format de fichier image tagué [.tiff]
- VOR - Modèle Stardraw 5.0 [.vor]
- VOR3 - Modèle Stardraw 3.0 [.vor]
- WMF - Windows Metafile [.wmf]
- xhtml - xhtml [.xhtml]
- xpm - x pixmap [.xpm]
La liste suivante des formats de présentation est actuellement disponible pour l'exportation vers:
- BMP - Windows Bitmap [.bmp]
- EMF - métafile amélioré [.EMF]
- EPS - PostScript encapsulé [.EPS]
- GIF - Format d'échange graphique [.gif]
- HTML - Document HTML (OpenOffice.org Impress) [.html]
- JPG - Group conjoint des experts photographiques [.jpg]
- Met - OS / 2 Metafile [.Met]
- Odd - OpenDocument Drawing (Impress) [.odd]
- ODG - OpenOffice.org 1.0 Drawing (OpenOffice.org Impress) [.odg]
- ODP - OpenDocument Présentation [.oDP]
- pbm - bitmap portable [.pbm]
- pct - mac pict [.pct]
- PDF - Format de document portable [.pdf]
- PGM - Graymap portable [.pgm]
- PNG - Graphique réseau portable [.png]
- Pot - Modèle Microsoft PowerPoint 97/2000 / XP [.pot]
- PPM - Portable PixelMap [.ppm]
- PPT - Microsoft PowerPoint 97/2000 / XP [.ppt]
- PWP - Placeware [.pwp]
- Ras - Sun Raster Image [.RAS]
- SDA - Stardraw 5.0 (OpenOffice.org Impress) [.sda]
- SDD - Starimpress 5.0 [.sdd]
- SDD3 - Stardraw 3.0 (OpenOffice.org Impress) [.sdd]
- sdd4 - starimpress 4.0 [.sdd]
- STI - OpenOffice.org 1.0 Modèle de présentation [.sti]
- STP - Template de présentation OpenDocument [.stp]
- SVG - Graphiques vectoriels évolutifs [.svg]
- SVM - StarView Metafile [.svm]
- SWF - Macromedia Flash (SWF) [.swf]
- Sxi - OpenOffice.org 1.0 Présentation [.sxi]
- TIFF - Format de fichier image tagué [.tiff]
- VOR - Modèle starimpress 5.0 [.vor]
- VOR3 - Modèle Stardraw 3.0 (OpenOffice.org Impress) [.vor]
- VOR4 - modèle starimpress 4.0 [.vor]
- VOR5 - Modèle Stardraw 5.0 (OpenOffice.org Impress) [.vor]
- WMF - Windows Metafile [.wmf]
- xhtml - xhtml [.xml]
- xpm - x pixmap [.xpm]
La liste suivante des formats de feuille de calcul est actuellement disponible pour l'exportation vers:
- CSV - Texte CSV [.csv]
- dbf - dBase [.dbf]
- Dif - Format d'échange de données [.dif]
- Document HTML - HTML (OpenOffice.org Calc) [.html]
- ODS - feuille de calcul du document ouvrir [.ods]
- OOXML - Microsoft Excel 2003 XML [.xml]
- PDF - Format de document portable [.pdf]
- PTS - Template de feuille de calcul OpenDocument [.pts]
- pxl - Pocket Excel [.pxl]
- SDC - Starcalc 5.0 [.SDC]
- SDC4 - Starcalc 4.0 [.sdc]
- SDC3 - Starcalc 3.0 [.sdc]
- slk - sylk [.slk]
- STC - OpenOffice.org 1.0 Template de feuille de calcul [.stc]
- SXC - OpenOffice.org 1.0 feuille de calcul [.sxc]
- VOR3 - Modèle StarCalc 3.0 [.vor]
- VOR4 - Modèle StarCalc 4.0 [.vor]
- VOR - Modèle StarCalc 5.0 [.vor]
- xhtml - xhtml [.xhtml]
- XLS - Microsoft Excel 97/2000 / XP [.xls]
- xls5 - Microsoft Excel 5.0 [.xls]
- xls95 - Microsoft Excel 95 [.xls]
- XLT - Modèle Microsoft Excel 97/2000 / XP [.xlt]
- xlt5 - Modèle Microsoft Excel 5.0 [.xlt]
- xlt95 - Modèle Microsoft Excel 95 [.xlt]
La liste suivante des formats Open Office est actuellement disponible pour l'exportation vers:
- Microsoft Word 6.0 / 95/97/2000 / XP (.doc et .dot)
- Microsoft Word 2003 XML (.xml)
- Microsoft Word 2007 XML (.docx, .docm, .dotx, .dotm)
- Microsoft Winword 5 (.doc)
- Document WordPerfect (.WPD)
- WPS 2000 / Office 1.0 (.WPS)
- .rtf, .txt et .csv
- Formats StarWriter (.SDW, .SGL, .VOR)
- Docbook (.xml)
- Texte de format de bureau unifié (.uot, .uof)
- Ichitaro 8/9/10/11 (.jtd et .jtt)
- Hangul WP 97 (.hwp)
- Document T602 (.602, .txt)
- Aportisdoc (Palm) (.pdb)
- Mot de poche (.psw)
- Microsoft Excel 97/2000 / XP (.xls, .xlw et .xlt)
- Microsoft Excel 4.x - 5.0 / 95 (.xls, .xlw et .xlt)
- Microsoft Excel 2003 XML (.xml)
- Microsoft Excel 2007 XML (.xlsx, .xlsm, .xltx, .xltm)
- Microsoft Excel 2007 Binary (.xlsb)
- Lotus 1-2-3 (.wk1, .wks et .123)
- Format d'échange de données (.dif)
- Format de texte riche (.rtf)
- Texte CSV (.csv et .txt)
- Formats StarCalc (.sdc et .vor)
- dBase (.dbf)
- Sylk (.slk)
- Feuille de calcul de format de bureau unifié (.uos, .uof)
- Fichiers .htm et .html, y compris les requêtes de page Web
- Pocket Excel (PXL)
- Quattro Pro 6.0 (.WB2)
- Microsoft PowerPoint 97/2000 / XP (.ppt, .pps et .pot)
- Microsoft PowerPoint 2007 (.pptx, .pptm, .potx, .potm)
- Stardraw et starimpress (.sda, .sdd, .sdp et .vor)
- Présentation du format de bureau unifié (.uop, .uof)
- CGM - Informatique Metafile (.CGM)
- Format de document portable (.pdf)
La liste suivante des formats vidéo est actuellement disponible pour l'exportation vers:
- 3G2 3GP2 (format de fichier 3GPP2)
- 3GP 3GP (format de fichier 3GPP)
- 4xm 4x Technologies
- A64 A64 - Vidéo pour Commodore 64
- AAC RAW ADTS AAC (Codage audio avancé)
- AC3 RAW AC-3
- ACT ACT Format de fichier vocal
- format de données ADF Artwork
- ADP ADP
- ADTS ADTS AAC (Codage audio avancé)
- ADX CRI ADX
- AEA MD Studio Audio
- AFC AFC
- Audio AIFF IFF
- Alaw PCM A-Law
- Image de pix Alias_Pix Alias / Wavefront
- Sortie audio Alsa Alsa
- AMR 3GPP AMR
- ANIMANIQUE ANME DELUXE
- APC cryo apc
- Audio de singe
- APNG Graphiques réseau portable animé
- sous-titres aqtitle aqtitle
- ASF ASF (format de streaming avancé / actif)
- asf_stream asf (format de streaming avancé / actif)
- Sous-titre SSA (Substation Alpha)
- AST AST (Stream audio)
- AU SUN AU
- Avi Avi (vidéo audio entrelacée)
- Avisynth Avisynth Script
- AVM2 SWF (Shockwave Flash) (AVM2)
- AVR AVR (recherche audio visuelle)
- AVS AVS
- Bethsoftvid Bethesda Softworks VID
- BFI Force et ignorance
- texte bin
- bink bink
- Bit G.729 Bit File Format
- Séquence BMP PIPE BMP_PIPE
- BMV Discworld II BMV
- Audio Boa Black Ops
- image Brender_Pix Brender Pix
- BRSTM BRSTM (Binary Revolution Stream)
- C93 Interplay C93
- CACA CACA (Couleur ASCII Art) Dispositif de sortie
- CAF Apple CAF (format audio de base)
- VIDÉO CAVSVIDEO RAW CHINOS CHINIS
- CDG CD Graphiques
- vidéo CDXL Commodore CDXL
- cine Phantom Cine
- script de concaténation virtuelle concat
- Test CRC CRC
- Dash Dash Mexer
- données brutes données
- Audio Daud D-Cinema
- DFA Chronomaster DFA
- Dirac Raw Dirac
- DNXHD RAW DNXHD (SMPTE VC-3)
- Séquence DPX DPX_PIPE
- Fichier DSF DSD Stream (DSF)
- Dsicine Delphine Software International Cin
- DSS Digital Speech Standard (DSS)
- DTS RAW DTS
- DTSHD RAW DTS-HD
- DV DV (vidéo numérique)
- DV1394 DV1394 A / V
- dvbsub brut dvbsub
- DVD MPEG-2 PS (DVD VOB)
- dxa dxa
- EA Electronic Arts Multimedia
- EA_CDATA Electronic Arts CData
- EAC3 RAW E-AC-3
- Fichier audio audio EPAF ENSONIQ PARIS
- séquence exr exr_pipe
- F32BE PCM 32 bits à virgule flottante
- F32LE PCM 32 bits à point flottant Little-Endien
- Vidéo F4V F4V Adobe Flash
- F64BE PCM 64 bits Big-endian à virgule flottante
- F64le PCM 64 bits à point flottant Little-Endien
- fbdev linux framebuffer
- FFM FFM (FFServer Live Feed)
- Métadata FFMetAdata FFMPEG dans le texte
- Film_cpk Sega Film / CPK
- Filmstrip Adobe Filmstrip
- flac brut flac
- Flic fli / flc / flx animation
- flv flv (vidéo flash)
- Test de Framecrc Framecrc
- Test de Framemd5 par trame MD5
- Crame MEGALUX FRM
- G722 RAW G.722
- G723_1 RAW G.723.1
- G729 G.729 Format brut Démuxer
- Animation GIF GIF
- GSM RAW GSM
- GXF GXF (format d'échange général)
- H261 RAW H.261
- H263 RAW H.263
- Vidéo H264 RAW H.264
- HDS HDS MUXER
- Video hevc hevc brut
- HLS Apple http en direct en direct
- HLS, Applehttp Apple http en direct en direct
- HNM cryo hnm v4
- ICO Microsoft Windows ICO
- Idcin Id cinématographique
- Fichier IDF Ice Draw
- IEC61883 LIBIEC61883 (Nouveau DV1394) Dispositif d'entrée A / V
- IFF IFF (format de fichier interchange)
- ILBC ILBC Storage
- Séquence Image2 Image2
- Séquence Image 2 Piped Image2Pipe
- ingénient MJPEG ingéniente brut
- IPMOVIE Interplay Mve
- iPod iPod H.264 MP4 (MPEG-4 partie 14)
- Ircam Berkeley / Ircam / Carl Sound Format
- ISMV ISMV / ISMA (streaming lisse)
- iss funcom iss
- Vidéo IV8 Indigovision 8000
- FIV ON2 IVF
- Séquence J2K J2K_Pipe
- kit de connexion audio jack jack
- Jacosub Jacosub Subtitle Format
- Séquence JPEG JPEG_PIPE
- Séquence JPEGLS JPEGLS_PIPE
- JV Bitmap Brothers JV
- LATM LOAS / LATM
- dispositif d'entrée virtuel Lavfi Libavfilter
- libcdio
- libdc1394 DC1394 V.2 A / V
- libgme jeu musique emu demuxer
- libmodplug modplug demuxer
- live_flv live rtmp flv (vidéo flash)
- LMLM4 RAW LMLM4
- LOAS LOAS Audiosyncstream
- LRC LRC Paroles
- LVF LVF
- LXF VR Native Stream (LXF)
- Vidéo M4V RAW MPEG-4
- matroska matroska
- matroska, webm matroska / webm
- Test MD5 MD5
- MGSTS Metal Gear solide: les serpents jumeaux
- MicroDVD MicrodVD Sous-titre Format
- Vidéo MJPEG RAW MJPEG
- Mkvtimestamp_v2 Extrait des pts en tant que format Timecode v2, tel que défini par Mkvtoolnix
- MLP RAW MLP
- Vidéo MLV Magic Lantern (MLV)
- MM American Laser Games MM
- MMF Yamaha Smaf
- Mov Quicktime / MOV
- MOV, MP4, M4A, 3GP, 3G2, MJ2 Quicktime / MOV
- MP2 MP2 (MPEG Audio Couche 2)
- MP3 MP3 (MPEG Audio Layer 3)
- MP4 MP4 (MPEG-4 partie 14)
- MPC MUSPACK
- MPC8 MUSEPACK SV8
- MPEG MPEG-1 Systems / MPEG Program Stream
- Vidéo MPEG1Video Raw MPEG-1
- Vidéo MPEG2Video Raw MPEG-2
- MPEGTS MPEG-TS (MPEG-2 Transport Stream)
- MPEGTSRAW RAW MPEG-TS (MPEG-2 Transport Stream)
- MPEGVIDEO RAW MPEG Video
- MPJPEG MIME Multipart JPEG
- sous-titres MPL2 MPL2
- sous-titres MPSUB mPlayer
- MSNWCTCP MSN TCP webcam Stream
- MTV MTV
- MULAW PCM MU-LAW
- film graphique MV silicium
- MVI Motion Pixels MVI
- MXF MXF (format d'échange de matériaux)
- MXF_D10 MXF (format d'échange de matériaux) Mappage D-10
- MXF_OPATOM MXF (Format d'échange de matériaux) atome de modèle
- Clip MXG MXPEG
- NC NC NC Camera Feed
- NISTHERE NIST RESSOURCES DE L'ENSEAU SPOCIAL
- NSV Nullsoft Streaming Video
- noix de noix
- nuv nuppelvideo
- Audio OGA OGG
- ogg ogg
- Audio Oma Sony OpenMG
- Appareil de capture audio Openal Openal
- sortie OpenGl OpenGL
- opus ogg opus
- La lecture OSS OSS (Open Sound System)
- Fichier d'animation PAF Amazing Studio emballé
- séquence de pictor de pipe Pictor_Pipe
- PJS PJS (Phoenix Japanation Society) Sous-titres
- PMP PlayStation Portable PMP
- Séquence PNG PNG_PIPE
- PSP PSP MP4 (MPEG-4 PARTIE 14)
- psxstr Sony Playstation Str
- Sortie audio d'impulsion d'impulsion
- PVA Technotrend PVA
- PVF PVF (format vocal portable)
- QCP QCP
- séquence Qdraw_pipe tuyaux
- R3D Redcode R3d
- Vidéo brut Rawvideo
- Format de sous-titre réel
- Spark de Spark
- rl2 rl2
- RM RealMedia
- ROQ RAW ID ROQ
- RPL RPL / ARMOVIE
- RSD Gamecube RSD
- RSO LEGO MINDSTORMS RSO
- Sortie RTP RTP
- RTP_MPEGTS RTP / MPEGTS Format de sortie
- Sortie RTSP RTSP
- S16BE PCM a signé Big-Endien 16 bits
- S16LE PCM a signé un petit-endian 16 bits
- S24BE PCM a signé Big-Endien 24 bits
- S24LE PCM a signé un petit-endian 24 bits
- S32BE PCM a signé Big-Endien 32 bits
- S32LE PCM a signé Little-Endien 32 bits
- S8 PCM signé 8 bits
- format de sous-titre sami sami
- sortie SAP SAP
- SBG SBAGEN BINAURAL BEATS SCRIPT
- Dispositif de sortie SDL SDL
- SDP SDP
- sdr2 sdr2
- segment du segment
- SGI_PIPE PIPED SGI SECENCE
- shn raccourci brut
- Siff Beam Software Siff
- Singlejpeg jpeg Image unique
- SLN ASTERISK RAW PCM
- Smjpeg Loki Sdl MJPEG
- smk smacker
- Smoothstreaming Smooth Streaming Muxer
- Smush Lucasarts Smush
- Sol Sierra Sol
- Sox Sox natif
- SPDIF IEC 61937 (utilisé sur S / PDIF - IEC958)
- SPX OGG SPEEX
- Sous-titre SRT Subrip
- Format de sous-titre STL Spruce
- Stream_segment, Ssegment Streaming Segment Muxer
- format de sous-titre de sous-vue de la sous-vue
- Subviewer1 Sous -Viewer V1 Sous-titre Format
- séquence sunrast de Sunrast_Pipe
- SUP RAW HDMV Présentation des sous-titres de flux graphique
- SVCD MPEG-2 PS (SVCD)
- SWF SWF (Shockwave Flash)
- tak brut
- Tedcaptions ted talks
- tee-shirt multiple en mousseur
- THP THP
- tiertexseq tiertex limité seq
- Séquence TIFF TIFF_PIPE
- TMV 8088FLEX TMV
- truehd brut truehd
- TTA TTA (True Audio)
- TTY TELE-TYPEWRITER
- TXD Renderware Texture Dictionary
- U16BE PCM Big-endian 16 bits non signé
- U16LE PCM UNSIGNÉ Little-Endien 16 bits
- u24be pcm non signé 24 bits big-endian
- u24le pcm non signé 24 bits petit-endian
- U32BE PCM UNSIGNÉ BIG-ENDIAN 32 BIT
- u32le pcm non signé 32 bits petit-endian
- U8 PCM non signé 8 bits
- Test de Framecrc non codé non codécracrc
- Dispositif de sortie V4L2 VIDEO4LINUX2
- vidéo VC1 RAW VC-1
- VC1Test VC-1 Test BitsTtream
- VCD MPEG-1 Systems / MPEG Program Stream (VCD)
- VIDEO4LINUX2, V4L2 Video4Linux2 Appareil
- vivo vivo
- VMD Sierra VMD
- VOB MPEG-2 PS (VOB)
- Vobsub vobsub sous-titre format
- VOC Creative Voice
- sous-titres VPlayer VPlayer
- VQF Nippon Telegraph and Telephone Corporation (NTT) TWINVQ
- W64 Sony Wave64
- WAV WAV / WAVE (Audio de forme d'onde)
- film WC3Movie Wing Commander III
- webm webm
- webm_chunk webm chunk muxer
- webm_dash_manifest webm dash manifeste
- webp webp
- Séquence webp webp_pipe
- Sous-titre WebVTT WebVTT
- Audio Wsaud Westwood Studios
- WSVQA Westwood Studios VQA
- WTV Windows Television (WTV)
- wv brut wavpack
- Capture d'écran X11Grab X11, en utilisant XCB
- xa maxis xa
- XBIN Texte binaire étendu (XBIN)
- XMV Microsoft XMV
- Dispositif de sortie XV XV (xvideo)
- XWMA Microsoft XWMA
- yop psygnosis yop
- yuv4mpegpipe yuv4mpeg tuyau