Re: Quartz from the Command Line
Re: Quartz from the Command Line
- Subject: Re: Quartz from the Command Line
- From: Steven Majewski <email@hidden>
- Date: Sun, 25 Apr 2004 18:19:45 -0400
On Apr 25, 2004, at 12:55 PM, Mike Paquette wrote:
On Apr 25, 2004, at 12:20 AM, Greg Hulands wrote:
I am about to create a tool that will composite two images together
and produce a composited image. It has to be a tool that can run
without a window server present (as it will be called from a
webobjects application). I am just looking into what libraries to use
to achieve this. I have tried linking against app kit and using
NSImage to composite the images together, but it fails as it try's to
make a connection to the window server.
The only other library available on OS X is the quartz library to
composite the images, but I do not know whether or not a window
server needs to be present in order for it to use the image
compositing functions.
I found this thread on mamasam:
http://cocoa.mamasam.com/MACOSXDEV/2002/05/2/34141.php
But there was no definitive answer that if you use these functions if
you do indeed need a window server present.
If an application links with high level application-oriented
frameworks such as Carbon or Cocoa, then during framework
initialization these frameworks may try to form a connection to the
window server. This is done in anticipation of a need to create
windows, menus, and Dock reporesentations and to prepare to receive
events.
The use of the Quartz (CG) functions to manipulate CGImageRefs and
generate bitmap contexts, such as you are doing, does not require a
connection to the window server. If you can avoid linking the Carbon
or Cocoa frameworks, then your program won't need to form a window
server connection. In general, this requires that your program link
with Foundation, for Objective-C usage, and ApplicationServices, for
Quartz access.
You may want to consider using the Python Quartz bindings available in
Mac OS X 10.3. If you have Developer tools installed, look at the
examples in /Developer/Examples/Quartz/Python. The contactsheet.py
example demonstrates loading multiple images from JPEG files and
assembling them in a single context. bitmap.py demonstrates how
create a bitmap context and save it as a PNG file.
There's also this article: Panther, Python and CoreGraphics:
http://www.macdevcenter.com/pub/a/mac/2004/03/19/core_graphics.html
I know that some AppKit methods work from the command line in Python --
for
example, you can grab text or image data from the clipboard
(generalPasteboard)
and save it from a file -- but I don't know if those functions depend
on the
window server being accessable. ( There are other AppKit methods that
don't really
work unless they are called from a App built as a bundle. )
You might also consider using ImageMagick <
http://imagemagick.org/>,
which
has a whole set of command line tools to do all sorts of image
manipulation.
It does not use Quartz or any apple libraries -- it just manipulates
image files.
-- Steve Majewski
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.