About getting information of text inside AI format

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
niha

About getting information of text inside AI format

Post by niha »

First, I would sorry to know if there is any topics that would mention the same problems. In case of so, please tell the me links, I would be happily switch to that topic.

After weeks trying get around with some problems arised from processing PSD format, I changed my target to a different one : AI format.

As I do some searching on the net, I get the AI 7 file specification ( in pdf ), and it show me some informations about how text is stored in and text's attribute. Right now I need to read the style of text in AI format file ( which is of 3 category : point text,area text and path text ), then apply to some text ( through some programming ), at the end, output to a JPG or GIF file with the style of text in AI for the specific text in programming.

Maybe I would describe more details :

I read in the AI specification that the font,colours and size of text is stored in some objects with the name of <textstyle>, as you might know that the AI stored objects inside with the BNF Syntax ( Backus-Naur Form ). So I think logically there would be able to read style of text inside AI file.

What I need now is use some programming language ( whatever it is ), and read the STYLE of the text inside a self-create AI file ( like I set color of the text to red, font size to 32, text = I Love U ) so I would have the output of program like : font = Tahoma, size = 32, colour = red , then apply these settings to a text "I love U so Much" with the properties ( style ) I just read from the text of AI file which is : colour = red, font =Tahoma size= 32, then make an output GIF/JPG which would display it.

I come to think of ImageMagick coz it's have powerful library for programming plus, we 've all known, ya free to study, I would keep searching for the informations about how to read the style, but would someone know the way, please tell me how, or some links, that would save me from re-invented the wheels, thanks in advance for all who read. Peace & out.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: About getting information of text inside AI format

Post by anthony »

It is true that AI image file format is a very well defined format.

But it is also true that that format is designed so that it is directly printable. That is it is a special variation of POSTSCRIPT.

IM reads AI vector images just as it would a normal postscript file. and as such it makes no attempt to read or figure out the exact internal format of AI, but leaves it up to ghostscript to convert the vector format into a raster format that IM can understand and process.


The format should not be too difficult to work out however.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
niha

Re: About getting information of text inside AI format

Post by niha »

Hi Anthony, first, thanks for your fast reply.

Say, in .ai file, there had been a text ( abritrary type from pointed text/area text/path text ), could ImageMagicK ( via GhostScript ) return the font/colour/size of that text ?

Thanks.

P.S :

I try to convert an AI file with ImageMagicK and get this errors :
http://hosted.pikipimp.com/pimped_photo ... mpiled.JPG
Any comments :D ? I used ImageMagick 6.4.5 and anotherAIFile.ai is created by Adobe Illustrator 10, thanks.

==> P.S <Solved> : I tried to reinstall GhostScript 8.63 and the convert commands work like a charm, thanks.

2nd P.S :

Hi Anthony, I just read this page : http://www.imagemagick.org/Usage/text/#postscript, at the section of "Draw - Draw Text on Existing Canvas", you output to GIF/JPEG with styled "Anthony" text, yeah, that's my main idea all about : Read font/color/size ( styles ) of texts ( abritrary text ) from an AI file and output to a GIF/JPG with "Anthony" text with the same font/color/size, is it possible ? If it is, please a-guide-for-idiot please. Much appreciated.

3rd P.S :

Hi again :D, Anthony, I just read several posts and now I can convert a .ai file with styled text inside to jpg/gif file, that mean, ImageMagick via GhostScript can get the style information of texts, great ==> so could I apply that information of that text's style to a text ( input from command line ) then output to jpg/gif file with that input text decorated the same style as the one in the AI file ? And, if you feel in a mood, please tell me how :D, highly appreciated your help :D. Thanks

4th P.S :

For detailed :

Say, I created an .ai file with Adobe Illustrator 10, then create an area text with content of "Finding Some Help", choosed a style, in this example, I choosed Bermuda Styles, font = Tahoma, Size = 48; save it as "test.ai".

Now, would there be a way to use ImageMagicK/GhostScript to get the style Bermuda, font = Tahoma,Size = 48 by reading the test.ai file and then apply that style to a text, say "Solved" , which output of a jpg/gif file with "Solved" text with style Bermuda, font = Tahoma, Size = 48 ?

Thanks for reading. Best Regards.
niha

Re: About getting information of text inside AI format

Post by niha »

Sorry for double post....

After some searchs, I was thinking about this :

Is it possible to change the text content of the AI file then save it ( so we would have the AI file with the new text with decoration oredi applied, then just "convert someAI.ai someJPG.jpg" ) and work done :D ?

Best Regards.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: About getting information of text inside AI format

Post by anthony »

niha wrote:I try to convert an AI file with ImageMagicK and get this errors :
http://hosted.pikipimp.com/pimped_photo ... mpiled.JPG
Any comments :D ?
You misstyped the name -- the file was NOT found!
==> P.S <Solved> : I tried to reinstall GhostScript 8.63 and the convert commands work like a charm, thanks.
You you typed the convert command with the right filename :)
Hi Anthony, I just read this page : http://www.imagemagick.org/Usage/text/#postscript, at the section of "Draw - Draw Text on Existing Canvas", you output to GIF/JPEG with styled "Anthony" text, yeah, that's my main idea all about : Read font/color/size ( styles ) of texts ( abritrary text ) from an AI file and output to a GIF/JPG with "Anthony" text with the same font/color/size, is it possible ? If it is, please a-guide-for-idiot please. Much appreciated.
You still need to either
  • figure out the font/color/size
  • OR Why not just replace the 'text' in the AI file :)
Now, would there be a way to use ImageMagicK/GhostScript to get the style Bermuda, font = Tahoma,Size = 48 by reading the test.ai file and then apply that style to a text, say "Solved" , which output of a jpg/gif file with "Solved" text with style Bermuda, font = Tahoma, Size = 48 ?
Ghostscript woul djust 'do it' it will not return the font/color/size information. IM itself just gets a raster image from ghostscript.


Can you give an example AI with just a single word of text in some font/color/size I'll take a look at the AI text file and see if I can spot the font specifications in that file.

You could tray that too if you want.

AI files if I remember have a big 'prefix' that define all the postscript definitions, but the actual image part that follows is probably quite simple.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: About getting information of text inside AI format

Post by anthony »

niha wrote:Is it possible to change the text content of the AI file then save it ( so we would have the AI file with the new text with decoration oredi applied, then just "convert someAI.ai someJPG.jpg" ) and work done :D ?
Of course. in fact it was one suggestion I just made for your previous post. But why not look at or post the simplest AI file with some text in it. As I said the format will have a complex perfix, but the main part the describes the image is probably quite simple.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
niha

Re: About getting information of text inside AI format

Post by niha »

anthony wrote:
Of course. in fact it was one suggestion I just made for your previous post. But why not look at or post the simplest AI file with some text in it. As I said the format will have a complex perfix, but the main part the describes the image is probably quite simple.
Hi Anthony, I upload the Test.ai with a text and Bermuda Style with it, here :

http://www.4shared.com/file/72150381/7284c257/Test.html

Please check if you could output a gif named test.gif ( or test.jpg ) with a text of "Anthony" with the decoration ( style ) like the text in the Test.ai, thanks

P.S :

I use Adobe Illustrator 10 to make this, hope it not too old. :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: About getting information of text inside AI format

Post by anthony »

OKAY looking at this AI file I was disappointed to find that all the data appears to be encoded in hexidecimal, with a weird compiled type of postscript. A VERY un-user-friendly format!

In fact it isn't postscript but PDF format!

Interesting multi-colored font though.

Looking though it looks to me like it isn't a font at all, but a directly draw vector outline! Especially after running it though a pdf2ps converter! Perhaps AI fonts are defined in a none standard way, in which case all that is in the file are lines and shapes. No letters or font definitions!

However running it though pdftotext does extract teh actual text characters, so that couldn't be right!

Hmmm looks like the font defination its built into the file which is why it is so large!

Sorry without actually studying the format using network references that is about as far as I can go.

The text is extractable, the font appears to be non-standard and included in the file, and the other aspects I can't seem to determine.

It was worth a try though!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
niha

Re: About getting information of text inside AI format

Post by niha »

Oh, my bad, I reviewed the .ai file and find out that some MS <Japanese Characters> was the font, I dont know the font either, really sorry.

I replaced the Test.ai with the font of Tahoma <Regular>, please have a look at it, thanks

Replaced the file with Tahoma<Regular> here :

http://www.4shared.com/file/72166236/6c1dc104/Test.html
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: About getting information of text inside AI format

Post by fmw42 »

niha wrote:Oh, my bad, I reviewed the .ai file and find out that some MS <Japanese Characters> was the font, I dont know the font either, really sorry.

I replaced the Test.ai with the font of Tahoma <Regular>, please have a look at it, thanks

Replaced the file with Tahoma<Regular> here :

http://www.4shared.com/file/72166236/6c1dc104/Test.html

Why don't you just

convert image.ai image.gif

if you just want a gif that looks the same as the ai
niha

Re: About getting information of text inside AI format

Post by niha »

Howdy fmw42 :D, I want to get the decoration to apply to another text, through programming, not only to get the text decorated in jpg/gif.
Post Reply