[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Parsing An Image File

Posted on 2002-05-08
8
Medium Priority
?
242 Views
Last Modified: 2012-05-04
I'm trying to get the photo cutline, photo author and extra information from an .eps file created from photoshop. Does anybody know a way to get just that text and at all turn the eps into different sized jpg's and gif's?
0
Comment
Question by:mattsobo
  • 4
5 Comments
 
LVL 2

Accepted Solution

by:
jpoesen earned 400 total points
ID: 6997544
and you want to use php for that? Shouldn't you start with downloading the photoshop SDK and reading the docs ?

Second step would be to use VC++ and the SDK to interact with PS.

Third step would be to make a COM component and talk to it using the PHP COM support functions...

0
 
LVL 32

Assisted Solution

by:Batalf
Batalf earned 400 total points
ID: 6997993
I'm not sure if ImageMagick gives you this information, but it's worth a shot. ImageMagick is a package of software to convert and identify images. It's free at www.imagemagick.org

Convertion:
For converting, you use the tool "convert". It supports convertion of eps to almost any format.

Identifying:
Here's some code I used earlier(for identifying):

         $textFile = "parameters.txt";
         $imageData = exec("identify -verbose 'MyFile.eps' >$textFile");
         $imageDataArray2 = file($textFile);
         for($no=0;$no<count($imageDataArray2);$no++)
         {
                 echo $imageDataArray2[$no]."<br>";
         }

---------------------------------------------------
This gave me an array like this:

         0 - Image: MyFile.eps
         1 - Format: PS (Adobe PostScript)
         2 - Geometry: 210x150
         3 - Class: DirectClass
         4 - Type: true color
         5 - Depth: 8 bits per pixel component
         6 - Colors: 23053
         7 - Filesize: 92kb
         8 - Interlace: None
         9 - Background Color: white
         10 - Border Color: #dfdfdf
         11 - Matte Color: grey74
         12 - Iterations: 0
         13 - Compression:
         14 - comment: Image generated by GNU Ghostscript (device=pnmraw)
         15 -
         16 - signature: 85f2bcbf52437b12c891355c9b4c75719febd2e1bffa32143c75304cbdaf9b7e
         17 - Tainted: False
         18 - User Time: 0.0u
         19 - Elapsed Time: 0:01

Batalf
0
 
LVL 32

Expert Comment

by:Batalf
ID: 6997999
And here's some code for convertion:

exec("convert -geometry 50% MyFile.eps output.jpg");

You may need to add the relative path to the "convert" file as a suffix to convert here.

This code creates output.jpg as a jpg of 50% of the original MyFile.eps.

ps! I'm not sure, but I don't think you could use these kind of tools to get information about the author.

Batalf

0
 
LVL 32

Expert Comment

by:Batalf
ID: 6998019
I tried to create an eps in photoshop now, and the only information I could read from the eps-file when I saved it was this:

%%Creator: Adobe Photoshop Version 6.0
%%Title: test.eps
%%CreationDate: Thu May 09 2002 05:25:52
%%BoundingBox: 0 0 20 20
%%HiResBoundingBox: 0 0 20 20
%%SuppressDotGainCompensation
%%EndComments
%%BeginProlog
%%EndProlog
%%BeginSetup
%%EndSetup
%ImageData: 20 20 8 3 1 20 1 "beginimage"
%BeginPhotoshop: 1542

The information about authour(File->document info) is saved on the first line, but it doesn't seem to be any logic where on the line. So that information is tricky to retreve.

But the other information here seems to be collectable. But if it's a clever idea to let php parse big eps'files is an other thing:-)

Batalf

0
 
LVL 32

Expert Comment

by:Batalf
ID: 6998022
ps! I was able to read the information above when I opened the eps-file in textpad.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question