0

I was able to read the paths data from a Photoshop file.Photoshop File Format. The curves bezier curves. I want to convert this data into pixel format. How do i do this?.

Magellan
  • 71
  • 1
  • 2
  • 11
  • Try using something like Cairo. Or ask a more specific question like "I want to render bezier curves in C/C++/Web/iOS/Android etc." Your available options might not be compatible between different platforms and languages. Good luck. – hkrish Jun 29 '16 at 08:26

1 Answers1

1

Read thouroughly the documentation given On the Adobe's Website. I separated the data as 26 byte records.

Let's say one of the record is as follows

0 0 | 0 12 0 0 0 1 0 0 | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 0

The first two bytes of each record is a selector to indicate what kind of path it is. 0 0 indicates that it is a Closed subpath length record.

The next 8 Bytes tell us the control point for the Bezier segment preceding the knot. Now this can again be split into two components X and Y the first 4 bytes are the vertical components.

0 12 0 0

I converted 12 0 0 to binary format and add them and them convert to decimal

00001100 + 00000000 + 00000000  = 00001100

and then converted the result back to decimal. Which gave me Y co-ordinate.

where 0 indicates that the position is in the positive range(Signed magnitude form).

The next 8 bytes indicate the the anchor point for the knot, and the last 8 bytes the control point for the Bezier segment leaving the knot. The X and Y Components can be found in a similar manner.

I had this data exported to a svg file and then ran a rasterizer to convert the point data to pixel data.

If someone comes across this post I Hope this helps. :)

Magellan
  • 71
  • 1
  • 2
  • 11