Hi Bernd I went with LEP and imagemagick, which is also quite slow. I will try your code and see how it compares" Thanks -pm
Sent from my iPad > On 27 Jun 2017, at 07:53, Bernd Fröhlich via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Peter Mew: > >> I am trying to use Miyako's rotate picture component in v13. >> I dont know if its not compatible but It wont run. > > Hi Peter, > I had some problems also (not sure what exactly), so I rolled my own: > > // Methode: PIC_Rotate > // Angelegt: BF 04.04.12 > // Objekt: Bildbearbeitung > // Beschreibung: Dreht das übergebene Bild um 90,180 oder 270 Grad im > Uhrzeigersinn > // ---------------------------------------------------- > > C_PICTURE($1;$Pict) > C_LONGINT($2) //Rotationsgrad > C_PICTURE($0) > > C_LONGINT($lWidth;$lHeigth;$lMax) > C_TEXT($tSVGRoot;$tPicRef) > > PICTURE PROPERTIES($1;$lWidth;$lHeigth) > CREATE THUMBNAIL($1;$Pict;$lWidth;$lHeigth) //EXIF-Daten entfernen, sonst > geht SVG_SET_TRANSFORM_ROTATE schief, wenn EXIF-Tags am Bild kleben, die auch > schon Rotationsinfos enthalten! > $lMax:=MaxInt ($lWidth;$lHeigth) > $tSVGRoot:=SVG_New ($lMax*2;$lMax*2) //Bereich der gross genug ist, Platz > für das Bild und die Rotation zu haben > $tPicRef:=SVG_New_embedded_image ($tSVGRoot;$Pict;$lMax;$lMax) //Obere Linke > Ecke des Bildes ist jetzt am Punkt $lMax,$lMax. Um diesen Punkt wird das Bild > rotiert > SVG_SET_TRANSFORM_ROTATE ($tPicRef;$2;$lMax;$lMax) > $0:=SVG_Export_to_picture ($tSVGRoot;1) > //Jetzt noch den gedrehten Teil wieder extrahieren: > Case of > : ($2=90) > TRANSFORM PICTURE($0;Crop;$lMax-$lHeigth;$lMax;$lHeigth;$lWidth) > //Breite und Höhe vertauscht, da das Bild gedreht wurde > : ($2=180) > TRANSFORM > PICTURE($0;Crop;$lMax-$lWidth;$lMax-$lHeigth;$lWidth;$lHeigth) > : ($2=270) > TRANSFORM PICTURE($0;Crop;$lMax;$lMax-$lWidth;$lHeigth;$lWidth) > //Breite und Höhe vertauscht, da das Bild gedreht wurde > Else > g4D_AlertErrCaseOf (Current method name;String($2)) > End case > SVG_CLEAR ($tSVGRoot) > > > Works, but unfortunately is quite slow. > I wonder when 4D will implement a native picture rotate method. > I think it is much needed. > > Greetings from Germany, > Bernd Fröhlich > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************