Re: Cocoa-dev Digest, Vol 16, Issue 1

2019-01-15 Thread Bruce Stephens
Thanks. Appreciated.

> On 16 Jan 2019, at 9:43 am, Vince DeMarco  wrote:
> 
> Here is code that will write it out as a PNG
> 
> void WriteImageToPath(CGImageRef image,const char *path)
> {
>CGImageDestinationRef dest;
>CFURLRef  url;
> 
>url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,(const 
> UInt8 *)path,strlen(path),0);
>dest = CGImageDestinationCreateWithURL(url,CFSTR("public.png"), 1, NULL);
> 
>CGImageDestinationAddImage(dest,image,NULL);
>CGImageDestinationFinalize(dest);
>CFRelease(url);
>CFRelease(dest);
> }
> 
> To write it out a a jpeg change the UTI type above from public.png -> 
> public.jpeg
> 
> 
> Its all and there should be examples.
> 
> Vince
> 
> 
>> On Jan 15, 2019, at 2:35 PM, Bruce Stephens  wrote:
>> 
>> Any chance to see those few lines of code for NSimage ImageIO to jpeg? 
>> Thanks. Bruce.
>> 
>>> On 16 Jan 2019, at 7:00 am, cocoa-dev-requ...@lists.apple.com wrote:
>>> 
>>> Send Cocoa-dev mailing list submissions to
>>>  cocoa-dev@lists.apple.com
>>> 
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>  https://lists.apple.com/mailman/listinfo/cocoa-dev
>>> or, via email, send a message with subject or body 'help' to
>>>  cocoa-dev-requ...@lists.apple.com
>>> 
>>> You can reach the person managing the list at
>>>  cocoa-dev-ow...@lists.apple.com
>>> 
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of Cocoa-dev digest..."
>>> 
>>> 
>>> Today's Topics:
>>> 
>>> 1. NSImage to JPEG file? (Carl Hoefs)
>>> 2. Re: NSImage to JPEG file? (Vince DeMarco)
>>> 3. Re: NSImage to JPEG file? (Carl Hoefs)
>>> 4. Re: NSImage to JPEG file? (Alex Zavatone)
>>> 
>>> 
>>> --
>>> 
>>> Message: 1
>>> Date: Mon, 14 Jan 2019 13:17:41 -0700
>>> From: Carl Hoefs 
>>> To: Cocoa Developers 
>>> Subject: NSImage to JPEG file?
>>> Message-ID:
>>>  <13373da6-ece9-445d-9ff0-08a78393e...@autonomy.caltech.edu>
>>> Content-Type: text/plain; CHARSET=US-ASCII
>>> 
>>> I have a background macOS daemon process (aka Foundation-based "command 
>>> line tool") that needs to write out a JPEG file to local disk. The image 
>>> resides in an NSImage object (or alternatively, an NSData of raw RGB image 
>>> data). 
>>> 
>>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>>> this?
>>> 
>>> -Carl
>>> 
>>> 
>>> 
>>> --
>>> 
>>> Message: 2
>>> Date: Mon, 14 Jan 2019 12:26:08 -0800
>>> From: Vince DeMarco 
>>> To: Carl Hoefs 
>>> Cc: Cocoa Developers 
>>> Subject: Re: NSImage to JPEG file?
>>> Message-ID: <64df7de3-f45f-4205-991c-84bf7e131...@apple.com>
>>> Content-Type: text/plain; CHARSET=US-ASCII
>>> 
>>> Use ImageIO.
>>> 
>>> create a CGImageDestinationRef and add the CGImage to it.
>>> 
>>> Vince
>>> 
>>> 
>>> 
>>>> On Jan 14, 2019, at 12:17 PM, Carl Hoefs  
>>>> wrote:
>>>> 
>>>> I have a background macOS daemon process (aka Foundation-based "command 
>>>> line tool") that needs to write out a JPEG file to local disk. The image 
>>>> resides in an NSImage object (or alternatively, an NSData of raw RGB image 
>>>> data). 
>>>> 
>>>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>>>> this?
>>>> 
>>>> -Carl
>>>> 
>>>> ___
>>>> 
>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>> 
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>> 
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/demarco%40apple.com
>>>> 
>>>> This email sent to dema...@apple.com
>>> 
>>> 
>>> 
>>> --
>>> 
>>> Message: 3
>>> Date: Mon, 14 Jan 2019 

Re: Cocoa-dev Digest, Vol 16, Issue 1

2019-01-15 Thread Bruce Stephens
Any chance to see those few lines of code for NSimage ImageIO to jpeg? Thanks. 
Bruce.

> On 16 Jan 2019, at 7:00 am, cocoa-dev-requ...@lists.apple.com wrote:
> 
> Send Cocoa-dev mailing list submissions to
>cocoa-dev@lists.apple.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>https://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
>cocoa-dev-requ...@lists.apple.com
> 
> You can reach the person managing the list at
>cocoa-dev-ow...@lists.apple.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
> 
> 
> Today's Topics:
> 
>   1. NSImage to JPEG file? (Carl Hoefs)
>   2. Re: NSImage to JPEG file? (Vince DeMarco)
>   3. Re: NSImage to JPEG file? (Carl Hoefs)
>   4. Re: NSImage to JPEG file? (Alex Zavatone)
> 
> 
> --
> 
> Message: 1
> Date: Mon, 14 Jan 2019 13:17:41 -0700
> From: Carl Hoefs 
> To: Cocoa Developers 
> Subject: NSImage to JPEG file?
> Message-ID:
><13373da6-ece9-445d-9ff0-08a78393e...@autonomy.caltech.edu>
> Content-Type: text/plain; CHARSET=US-ASCII
> 
> I have a background macOS daemon process (aka Foundation-based "command line 
> tool") that needs to write out a JPEG file to local disk. The image resides 
> in an NSImage object (or alternatively, an NSData of raw RGB image data). 
> 
> Short of resorting to something like libjpeg, what is the ObjC way to do this?
> 
> -Carl
> 
> 
> 
> --
> 
> Message: 2
> Date: Mon, 14 Jan 2019 12:26:08 -0800
> From: Vince DeMarco 
> To: Carl Hoefs 
> Cc: Cocoa Developers 
> Subject: Re: NSImage to JPEG file?
> Message-ID: <64df7de3-f45f-4205-991c-84bf7e131...@apple.com>
> Content-Type: text/plain; CHARSET=US-ASCII
> 
> Use ImageIO.
> 
> create a CGImageDestinationRef and add the CGImage to it.
> 
> Vince
> 
> 
> 
>> On Jan 14, 2019, at 12:17 PM, Carl Hoefs  
>> wrote:
>> 
>> I have a background macOS daemon process (aka Foundation-based "command line 
>> tool") that needs to write out a JPEG file to local disk. The image resides 
>> in an NSImage object (or alternatively, an NSData of raw RGB image data). 
>> 
>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>> this?
>> 
>> -Carl
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/demarco%40apple.com
>> 
>> This email sent to dema...@apple.com
> 
> 
> 
> --
> 
> Message: 3
> Date: Mon, 14 Jan 2019 14:48:15 -0700
> From: Carl Hoefs 
> To: Vince DeMarco 
> Cc: Cocoa Developers 
> Subject: Re: NSImage to JPEG file?
> Message-ID:
>
> Content-Type: text/plain; CHARSET=US-ASCII
> 
> Got it working!
> Thanks, that's the tip I needed. 
> -Carl
> 
> 
>> On Jan 14, 2019, at 1:26 PM, Vince DeMarco  wrote:
>> 
>> Use ImageIO.
>> 
>> create a CGImageDestinationRef and add the CGImage to it.
>> 
>> Vince
>> 
>> 
>> 
>>> On Jan 14, 2019, at 12:17 PM, Carl Hoefs  
>>> wrote:
>>> 
>>> I have a background macOS daemon process (aka Foundation-based "command 
>>> line tool") that needs to write out a JPEG file to local disk. The image 
>>> resides in an NSImage object (or alternatively, an NSData of raw RGB image 
>>> data). 
>>> 
>>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>>> this?
>>> 
>>> -Carl
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/demarco%40apple.com
>>> 
>>> This email sent to dema...@apple.com
>> 
> 
> 
> 
> --
> 
> Message: 4
> Date: Mon, 14 Jan 2019 16:06:54 -0600
> From: Alex Zavatone 
> To: Carl Hoefs 
> Cc: Cocoa Developers 
> Subject: Re: NSImage to JPEG file?
> Message-ID: <6e8e883e-245d-43ab-88eb-ba4cd0ed9...@mac.com>
> Content-Type: text/plain; CHARSET=US-ASCII
> 
> I will send you something.
> 
> Sent from my iPhone
> 
>> On Jan 14, 2019, at 2:17 PM, Carl Hoefs  
>> wrote:
>> 
>> I have a background macOS daemon process (aka Foundation-based "command line 
>> tool") that needs to write out a JPEG file to local disk. The image resides 
>> in an NSImage object (or alternatively, an NSData of raw RGB image data). 
>> 
>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>> this?
>> 
>> -Carl
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@l

Re: Emailing from a daemon process

2016-08-03 Thread Bruce Stephens
Could use a simple Perl script… quick easy and nasty…
#!/usr/bin/perl
# 
…
# from an old online sales system that is still operational
...
{
open(MAIL2,"|/usr/sbin/sendmail -t -f nobody") ||
&mydie("Hmmm, a nasty horrible server error has 
occurred, please contact us...");
print MAIL2 "To: $emailAddress1\n";
print MAIL2 "Subject: The ORDER from $theName\n";
myResult(MAIL2);
close (MAIL2);
};


Works!!!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com