8 messages in org.openoffice.fr.prog[prog] redimensionner image JPG par ...
FromSent OnAttachments
Rémi BSep 1, 2008 2:22 pm 
Bernard MarcellySep 2, 2008 5:39 am 
Rémi BSep 2, 2008 10:43 am 
Bernard MarcellySep 2, 2008 12:34 pm 
Rémi BSep 2, 2008 1:18 pm 
Didier Dorange-PattoretSep 2, 2008 1:35 pm 
Bernard MarcellySep 3, 2008 3:12 am 
Rémi BSep 4, 2008 1:46 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[prog] redimensionner image JPG par macroActions...
From:Rémi B (rbou@free.fr)
Date:Sep 1, 2008 2:22:11 pm
List:org.openoffice.fr.prog

Bonjour,

Comment faire pour récupérer les dimensions d'une image au format *.jpg par macro basic ?

Pour l'instant, j'arrive à obtenir quelque chose avec un code comme : oImage = ThisComponent.createInstance ("com.sun.star.drawing.GraphicObjectShape") oImage.GraphicURL = "/home/remi/test.jpg" print oImage.getsize().width

sauf que la dernière instruction renvoie 100. Idem pour la hauteur alors que l'image n'est pas carrée... Une idée ?

Avec un fichier BMP, le script suivant fonctionne :

Sub resizeImageByWidth(uneImage As Object, largeur As Long) Dim leBitMap As Object, Proportion As Double Dim Taille1 As New com.sun.star.awt.Size LeBitmap = uneImage.GraphicObjectFillBitmap Taille1 = LeBitMap.Size ' taille en pixels ! Proportion = Taille1.Height / Taille1.Width Taille1.Width = largeur ' largeur en 1/100 de mm Taille1.Height = Taille1.Width * Proportion uneImage.Size = Taille1 End Sub

d'après l'API, GraphicObjectFillBitmap est DEPRECATED : http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/ GraphicObjectShape.html#GraphicObjectFillBitmap

Que faire alors ? Merci pour vore aide. Rémi.