Help needed - Image rotation via script

kabexefkabexef Posts: 77

I try to rotate an image via a layerd texture but can't get a useable result.

Here is what I tried:

var image = new Image(sInFileName);var layeredTexture = imgMgr.createLayeredTexture("RotateImageTexture");layeredTexture.beginEditing();var layer = layeredTexture.createLayer("RotateImageTextureLayer");layer.imageFile = sInFileName;layer.rotation = DzTextureComponent.Rot90;layeredTexture.setTextureToRefresh();layeredTexture.refreshLayeredTexture();layeredTexture.refresh();layeredTexture.endEditing();var layeredPixmap = layeredTexture.getPreviewPixmap(image.width, image.height);image = layeredPixmap.toImage();image.save(sOutFileName);

var image = new Image(sInFileName);
var layeredTexture = imgMgr.createLayeredTexture("RotateImageTexture");
layeredTexture.beginEditing();
var layer = layeredTexture.createLayer("RotateImageTextureLayer");
layer.imageFile = sInFileName;
layer.rotation = DzTextureComponent.Rot90;
layeredTexture.setTextureToRefresh();
layeredTexture.refreshLayeredTexture();
layeredTexture.refresh();
layeredTexture.endEditing();
var layeredPixmap = layeredTexture.getPreviewPixmap(image.width, image.height);
image = layeredPixmap.toImage();
image.save(sOutFileName);

Is this the correct but still flawed way or do I need to do something else to get a rotated image?

Thanks for help.

Post edited by kabexef on
Sign In or Register to comment.