• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)


  • Subject: Re: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)
  • From: email@hidden
  • Date: Tue, 26 Mar 2002 04:29:18 -0500

I believe I have a solution for you. Convert the image files into PNM ASCII format. I don't know what Mac program out there do this, though there should be some, but if you're running OS X, you can download and compile some (free) command line programs to manipulate them. (Don't ask me where to find them, I only know they exist on my Linux machine.) The file format for this is very simple, in fact it is in clear text (no screwy non-printing characters). Each pixel is a number on a line of its own from 0 (black) to 255 (white) in 8-8-8 RGB. The first line of the file is "P3" which I believe specifies what I just said. The next line is a set of dimensions of the image e.g. "200 200" means 200 by 200 pixels. Then the image data (pixels) begins. There may be comments in the file (e.g. creator). Such lines are identified by beginning with "#". From there, it should be quite easy to manipulate the file to do what you describe, however, you might find it easier as a shell script than AppleScript.

-- Adrian Horodeckyj

From: email@hidden
Date: Tue Mar 26, 2002 01:53:34 AM US/Eastern
To: email@hidden
Subject: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)

I have the not so enviable task of decomposing a set of font faces into text
files for downloading into a specialty-task printer. Bear with me on this
explanation of my need for help. I need to be able to take either a
black-and-white bitmapped file (tif, bmp, etc) and convert the whole thing
into a text file, with the pound symbol (#) representing a black pixel and a
period (.) representing a white pixel, and return representing the end of the
row of pixels.

Or, in an ideal world, I'd be able to parse a bitmapped font face directly
into this text format.

While I have the where-withall to create the text file, to write the text,
etc., I need some pointers on data structures and accessing the data
structures of either tif, bmp or font bitmap files so I can suck them in and
digest them to generate the results I need. Does anyone either:
(a) have a reference for the file specifications for any of those formats; or
(b) can recommend a good printed ref that would give me the information; or
(c) know of some premade solution (or a graphics/font app that is scriptable
to query pixel by pixel); or
(d) know of a scripting addition that would let me get at the data within any
of those file types pixel by pixel?

In general, machine time is cheap enough that it doesn't have to be a pretty
solution, just an effective one.

Any comments or help would be greatly appreciated.
=-= Marc Glasgow
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)
      • From: Mr Tea <email@hidden>
  • Prev by Date: Re: Osaxen not loading at startup
  • Next by Date: applescript cgi - url redirection (final)
  • Previous by thread: Quark PPD Options
  • Next by thread: Re: Decomposing a B&W bitmap graphic (or ideally, a font bitmap)
  • Index(es):
    • Date
    • Thread