Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
chenwp  
#1 Posted : Tuesday, August 13, 2019 7:34:22 PM(UTC)
chenwp

Rank: Member

Groups: Member
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?
Fedor  
#2 Posted : Thursday, August 15, 2019 10:20:42 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Originally Posted by: chenwp Go to Quoted Post
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?


Do you use PsdReader or PsdProcessor?

You can extract the rotation angle using the Transform property. The transform matrix contains scale, skew and rotate information, so you need to use math to extract the angle.

As for reading line-spacing please refer to the leading value:

https://www.graphicsmill.com/doc...PsdTextFrame_Leading.htm

https://www.graphicsmill.com/doc...anced-formatted-text.htm
Best regards,
Fedor Skvortsov
chenwp  
#3 Posted : Sunday, August 18, 2019 10:41:35 PM(UTC)
chenwp

Rank: Member

Groups: Member
Joined: 8/13/2019(UTC)
Posts: 17

Thanks: 1 times
Originally Posted by: Fedor Go to Quoted Post
Originally Posted by: chenwp Go to Quoted Post
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?


Do you use PsdReader or PsdProcessor?

You can extract the rotation angle using the Transform property. The transform matrix contains scale, skew and rotate information, so you need to use math to extract the angle.

As for reading line-spacing please refer to the leading value:

https://www.graphicsmill.com/doc...PsdTextFrame_Leading.htm

https://www.graphicsmill.com/doc...anced-formatted-text.htm


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.



Fedor  
#4 Posted : Tuesday, August 20, 2019 7:35:46 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Please see this post:

https://snipplr.com/view...x-affine-transformation/

If something is unclear please let me know.
Best regards,
Fedor Skvortsov
chenwp  
#5 Posted : Tuesday, August 20, 2019 11:02:23 PM(UTC)
chenwp

Rank: Member

Groups: Member
Joined: 8/13/2019(UTC)
Posts: 17

Thanks: 1 times
Originally Posted by: Fedor Go to Quoted Post
Please see this post:

https://snipplr.com/view...x-affine-transformation/

If something is unclear please let me know.


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
Fedor  
#6 Posted : Saturday, August 24, 2019 9:07:33 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
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

Code:
0
0
0
-15,1895014853814

Edited by user Saturday, August 24, 2019 9:08:05 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
chenwp  
#7 Posted : Saturday, August 31, 2019 11:47:53 PM(UTC)
chenwp

Rank: Member

Groups: Member
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
Eugene Kosmin  
#8 Posted : Sunday, September 1, 2019 11:08:52 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
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
chenwp  
#9 Posted : Tuesday, September 3, 2019 6:27:51 PM(UTC)
chenwp

Rank: Member

Groups: Member
Joined: 8/13/2019(UTC)
Posts: 17

Thanks: 1 times
Originally Posted by: Eugene Kosmin Go to Quoted Post
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).
Eugene Kosmin  
#10 Posted : Tuesday, September 10, 2019 6:27:22 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
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
thanks 1 user thanked Eugene Kosmin for this useful post.
chenwp on 9/10/2019(UTC)
Users browsing this topic
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.