Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
How to Get Frames Rotation Angle Property in PSD?
Rank: Member
Groups: Guest
Joined: 8/13/2019(UTC) Posts: 17
Thanks: 1 times
|
I want to get the rotation angle in psd frame.But I don't know how to get it? What should I do? And I want to get line spacing in text frame . The line spacing is line-height in html css. Can you help me?
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/13/2019(UTC) Posts: 17
Thanks: 1 times
|
Originally Posted by: Fedor I use PsdReader . I look the Transform property,but I get the value is IsIdentity false IsInvertible true OffsetX 43.7267075 OffsetY 133.208435 Elements[0] 0.8255737 Elements[1] -0.563502848 Elements[2] 0.563502848 Elements[3] 0.8255737 Elements[4] 43.7267075 Elements[5] 133.208435 How can I extract the angle. And PsdTextFrame has transform.But PsdSmartFrame have not the property. I want to get angle,too.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/13/2019(UTC) Posts: 17
Thanks: 1 times
|
Originally Posted by: Fedor rot = Math.Atan2( _ pts(1).Y - pts(0).Y, _ pts(1).X - pts(0).X) * 180.0 / Math.PI I don't konw this. Which PTS corresponds to? And the leading property corresponds to line height in css? The value of leading property is sometimes wrong. In ps value:72.02, in leading:314.888855
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Here is a code sample based on the above VB one: Code:using Aurigma.GraphicsMill.Codecs.Psd;
using System;
class Program
{
static void Main(string[] args)
{
using (var psdReader = new PsdReader("../../BusinessCard.psd"))
{
for (int i = 0; i < psdReader.Frames.Count; i++)
{
var frame = psdReader.Frames[i];
if (frame.Type == FrameType.Text)
{
var textFrame = (PsdTextFrame)frame;
//The original matrix
var matrix0 = textFrame.Transform;
//Remove translation
var matrix1 = new System.Drawing.Drawing2D.Matrix();
matrix1.Multiply(matrix0);
matrix1.Translate(-matrix0.OffsetX, -matrix0.OffsetY);
//Get rotation
var points = new System.Drawing.PointF[2];
points[0] = new System.Drawing.PointF(0, 0);
points[1] = new System.Drawing.PointF(1, 0);
matrix1.TransformPoints(points);
var rotation = Math.Atan2(points[1].Y - points[0].Y,
points[1].X - points[0].X) * 180.0f / Math.PI;
Console.WriteLine(rotation);
}
}
}
}
}
This code outputs the following result for our test image: https://github.com/aurig.../_Input/BusinessCard.psd Edited by user Saturday, August 24, 2019 9:08:05 AM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/13/2019(UTC) Posts: 17
Thanks: 1 times
|
Does the leading property corresponds to line height in css? The value of leading property is sometimes wrong. For example:in ps value:72.02, in leading:314.888855
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Leading and line-height in CSS are not the same. Leading is a char property while line-height is a property of a line box. However, they are both related to interline distance. Please post here PSD file with wrong leading, we'll check it. |
Best regards, Eugene Kosmin The Aurigma Development Team
|
|
|
|
Rank: Member
Groups: Guest
Joined: 8/13/2019(UTC) Posts: 17
Thanks: 1 times
|
Originally Posted by: Eugene Kosmin Leading and line-height in CSS are not the same. Leading is a char property while line-height is a property of a line box. However, they are both related to interline distance. Please post here PSD file with wrong leading, we'll check it. 5.rar (1,807kb) downloaded 4 time(s).
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
It's a bug. I've added it to our bug tracker. We'll post here when it's ready. |
Best regards, Eugene Kosmin The Aurigma Development Team
|
1 user thanked Eugene Kosmin for this useful post.
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
How to Get Frames Rotation Angle Property in PSD?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.