

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
8 messages in org.openoffice.fr.prog[prog] Re: redimensionner image JPG ...| From | Sent On | Attachments |
|---|---|---|
| Rémi B | Sep 1, 2008 2:22 pm | |
| Bernard Marcelly | Sep 2, 2008 5:39 am | |
| Rémi B | Sep 2, 2008 10:43 am | |
| Bernard Marcelly | Sep 2, 2008 12:34 pm | |
| Rémi B | Sep 2, 2008 1:18 pm | |
| Didier Dorange-Pattoret | Sep 2, 2008 1:35 pm | |
| Bernard Marcelly | Sep 3, 2008 3:12 am | |
| Rémi B | Sep 4, 2008 1:46 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [prog] Re: redimensionner image JPG par macro | Actions... |
|---|---|---|
| From: | Rémi B (rbou...@free.fr) | |
| Date: | Sep 2, 2008 10:43:00 am | |
| List: | org.openoffice.fr.prog | |
Bernard Marcelly wrote:
Bonjour, Réponses dans la demande...
Message de Rémi B date 2008-09-01 23:22 :
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") ( ... )
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
La routine resizeImageByWidth marche avec n'importe quel format de fichier bitmap (png, jpg, etc). Il suffit de lui transmettre ta variable oImage, comme l'explique le livre Programmation OpenOffice.org 2 page 565.
Oui, c'est presque mon livre de chevet en ce moment :-)
d'après l'API, GraphicObjectFillBitmap est DEPRECATED : http://api.openoffice.org/docs/common/ref/com/sun/star/drawing/ GraphicObjectShape.html#GraphicObjectFillBitmap
Il faut lire tout ce qui est écrit à ce propos : Deprecated. Use graphic property instead! Il s'agit d'une propriété appelée Graphic, ajoutée avec la version 2.
Un petit coup de Xray sur cette propriété t'indique qu'elle renvoie un objet contenant: .SizePixel .Size100thMM Tous deux sont des structures com.sun.star.awt.Size
Ok merci. Cependant, tous mes essais se révèlent infructueux. Comment utiliser cette propriété ? J'ai essayé LeBitmap = uneImage.Graphic (!) et d'autres choses encore que je n'ose pas avouer ici...
Comment par exemple récupérer la taille de l'image ? Merci.







