Hello,
I'm writing a script where I need to “Place” an image in an existing document. I've found some code here on the forum (bb/viewtopic.php?p=27002) but it doesn't place my image at 0,0 (I'm calling the method with 0,0,100,100 parameters). Instead it places it at 0,1 or 1,0 or 1,1 it's looks very random... I was wondering if there is another command or something I could run after I place the file to make sure it is actually placed at 0,0?
(I'm trying this code in CS6,5 and 4. On none of these versions it actually places it on 0,0.)
I don’t know if this is of any help, but when you press ‘F’ once -so you can move your canvas around- and you move the image to the top left and run the script, the placed image is all the way in the bottom right corner, it looks like it gets placed at 0,0 “screen space” or something? (explanation image: https://dl.dropboxusercontent.com/u/880 ... edFile.jpg ... edFile.jpg)
Any help would be greatly appreciated!
Place image at 0,0
-
pfaffenbichler
Place image at 0,0
I suppose you could include alignment steps or use the method »offset« with negative values of bounds[0] and bounds[1].
-
Bob256
Place image at 0,0
Thank you pfaffenbichler! I've ended up translating the new layer using negative values of bounds. You can see it move after the file has been placed, but that's not too bad! If there is a faster way though, please let me know!
object[] bounds = combinedLayer.Bounds;
combinedLayer.Translate(-(double)bounds[0], -(double)bounds[1]);
object[] bounds = combinedLayer.Bounds;
combinedLayer.Translate(-(double)bounds[0], -(double)bounds[1]);